diff --git a/internal/builds/register_test.go b/internal/builds/register_test.go index fcd0389db65b5e3d465ab63e0be9fd4cf15192a5..f28068d1b35444ad2c66478320fcb67a9e0fd131 100644 --- a/internal/builds/register_test.go +++ b/internal/builds/register_test.go @@ -26,7 +26,7 @@ func expectHandlerWithWatcher(t *testing.T, watchHandler WatchKeyHandler, data s h := RegisterHandler(echoRequestFunc, watchHandler, time.Second) rw := httptest.NewRecorder() - req := httptest.NewRequest("POST", "/", bytes.NewBufferString(data)) + req, _ := http.NewRequest("POST", "/", bytes.NewBufferString(data)) req.Header.Set("Content-Type", contentType) h.ServeHTTP(rw, req) diff --git a/internal/helper/helpers_test.go b/internal/helper/helpers_test.go index e0712c682308da1ec781394136760bee23dc3b56..66888adc4921f62d9e3c45d69e289d5b296bcc38 100644 --- a/internal/helper/helpers_test.go +++ b/internal/helper/helpers_test.go @@ -56,7 +56,7 @@ func TestSetForwardedForGeneratesHeader(t *testing.T) { func TestReadRequestBody(t *testing.T) { data := []byte("123456") rw := httptest.NewRecorder() - req := httptest.NewRequest("POST", "/test", bytes.NewBuffer(data)) + req, _ := http.NewRequest("POST", "/test", bytes.NewBuffer(data)) result, err := ReadRequestBody(rw, req, 1000) assert.NoError(t, err) @@ -66,7 +66,7 @@ func TestReadRequestBody(t *testing.T) { func TestReadRequestBodyLimit(t *testing.T) { data := []byte("123456") rw := httptest.NewRecorder() - req := httptest.NewRequest("POST", "/test", bytes.NewBuffer(data)) + req, _ := http.NewRequest("POST", "/test", bytes.NewBuffer(data)) result, err := ReadRequestBody(rw, req, 2) assert.Error(t, err) @@ -76,7 +76,7 @@ func TestReadRequestBodyLimit(t *testing.T) { func TestCloneRequestWithBody(t *testing.T) { input := []byte("test") newInput := []byte("new body") - req := httptest.NewRequest("POST", "/test", bytes.NewBuffer(input)) + req, _ := http.NewRequest("POST", "/test", bytes.NewBuffer(input)) newReq := CloneRequestWithNewBody(req, newInput) assert.NotEqual(t, req, newReq) @@ -89,7 +89,7 @@ func TestCloneRequestWithBody(t *testing.T) { } func TestApplicationJson(t *testing.T) { - req := httptest.NewRequest("POST", "/test", nil) + req, _ := http.NewRequest("POST", "/test", nil) req.Header.Set("Content-Type", "application/json") assert.True(t, IsApplicationJson(req), "expected to match 'application/json' as 'application/json'")