diff --git a/api.go b/api.go index cc00849a60a2a46da298d8915d079962d78e0fdc..681b719c1a2b96e6f6feb952f59aecf791fbb740 100644 --- a/api.go +++ b/api.go @@ -793,6 +793,7 @@ func createRouter(srv *Server, logging bool) (*mux.Router, error) { if srv.enableCors { writeCorsHeaders(w, r) } + w.WriteHeader(http.StatusOK) }) return r, nil } diff --git a/api_test.go b/api_test.go index 748bcf812cad49ea66eda356a3c02e41c87f8743..62da94113a89bd3dac2051cec91b4c9df33a88d3 100644 --- a/api_test.go +++ b/api_test.go @@ -1260,7 +1260,7 @@ func TestOptionsRoute(t *testing.T) { } router.ServeHTTP(r, req) - if r.Code != 200 { + if r.Code != http.StatusOK { t.Errorf("Expected response for OPTIONS request to be \"200\", %v found.", r.Code) } } @@ -1287,7 +1287,7 @@ func TestGetEnabledCors(t *testing.T) { } router.ServeHTTP(r, req) - if r.Code != 200 { + if r.Code != http.StatusOK { t.Errorf("Expected response for OPTIONS request to be \"200\", %v found.", r.Code) }