diff --git a/discovery/consul/consul_test.go b/discovery/consul/consul_test.go index 9dc2d660b..c92960163 100644 --- a/discovery/consul/consul_test.go +++ b/discovery/consul/consul_test.go @@ -365,7 +365,7 @@ func TestGetDatacenterShouldReturnError(t *testing.T) { { // Define a handler that will return status 500. handler: func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(500) + w.WriteHeader(http.StatusInternalServerError) }, errMessage: "Unexpected response code: 500 ()", }, diff --git a/discovery/xds/xds_test.go b/discovery/xds/xds_test.go index b6c141e28..974a47342 100644 --- a/discovery/xds/xds_test.go +++ b/discovery/xds/xds_test.go @@ -74,16 +74,16 @@ func createTestHTTPServer(t *testing.T, responder discoveryResponder) *httptest. discoveryRes, err := responder(discoveryReq) if err != nil { - w.WriteHeader(500) + w.WriteHeader(http.StatusInternalServerError) return } if discoveryRes == nil { - w.WriteHeader(304) + w.WriteHeader(http.StatusNotModified) return } - w.WriteHeader(200) + w.WriteHeader(http.StatusOK) data, err := protoJSONMarshalOptions.Marshal(discoveryRes) require.NoError(t, err) diff --git a/storage/remote/client_test.go b/storage/remote/client_test.go index c040667a5..9c99b292e 100644 --- a/storage/remote/client_test.go +++ b/storage/remote/client_test.go @@ -87,7 +87,7 @@ func TestStoreHTTPErrorHandling(t *testing.T) { func TestClientRetryAfter(t *testing.T) { server := httptest.NewServer( http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - http.Error(w, longErrMessage, 429) + http.Error(w, longErrMessage, http.StatusTooManyRequests) }), ) defer server.Close() diff --git a/web/api/v1/api_test.go b/web/api/v1/api_test.go index 919fad34b..80bc11087 100644 --- a/web/api/v1/api_test.go +++ b/web/api/v1/api_test.go @@ -2783,7 +2783,7 @@ func TestRespondSuccess(t *testing.T) { t.Fatalf("Error reading response body: %s", err) } - if resp.StatusCode != 200 { + if resp.StatusCode != http.StatusOK { t.Fatalf("Return code %d expected in success response but got %d", 200, resp.StatusCode) } if h := resp.Header.Get("Content-Type"); h != "application/json" {