chore: fix lint errors (#2520)

This commit is contained in:
Kevin Wan
2022-10-17 06:30:58 +08:00
committed by GitHub
parent d4c9fd2aff
commit 05a5de7c6d
27 changed files with 117 additions and 148 deletions

View File

@@ -65,7 +65,7 @@ func TestCorsHandlerWithOrigins(t *testing.T) {
for _, method := range methods {
test := test
t.Run(test.name+"-handler", func(t *testing.T) {
r := httptest.NewRequest(method, "http://localhost", nil)
r := httptest.NewRequest(method, "http://localhost", http.NoBody)
r.Header.Set(originHeader, test.reqOrigin)
w := httptest.NewRecorder()
handler := NotAllowedHandler(nil, test.origins...)
@@ -78,7 +78,7 @@ func TestCorsHandlerWithOrigins(t *testing.T) {
assert.Equal(t, test.expect, w.Header().Get(allowOrigin))
})
t.Run(test.name+"-handler-custom", func(t *testing.T) {
r := httptest.NewRequest(method, "http://localhost", nil)
r := httptest.NewRequest(method, "http://localhost", http.NoBody)
r.Header.Set(originHeader, test.reqOrigin)
w := httptest.NewRecorder()
handler := NotAllowedHandler(func(w http.ResponseWriter) {
@@ -100,7 +100,7 @@ func TestCorsHandlerWithOrigins(t *testing.T) {
for _, method := range methods {
test := test
t.Run(test.name+"-middleware", func(t *testing.T) {
r := httptest.NewRequest(method, "http://localhost", nil)
r := httptest.NewRequest(method, "http://localhost", http.NoBody)
r.Header.Set(originHeader, test.reqOrigin)
w := httptest.NewRecorder()
handler := Middleware(nil, test.origins...)(func(w http.ResponseWriter, r *http.Request) {
@@ -115,7 +115,7 @@ func TestCorsHandlerWithOrigins(t *testing.T) {
assert.Equal(t, test.expect, w.Header().Get(allowOrigin))
})
t.Run(test.name+"-middleware-custom", func(t *testing.T) {
r := httptest.NewRequest(method, "http://localhost", nil)
r := httptest.NewRequest(method, "http://localhost", http.NoBody)
r.Header.Set(originHeader, test.reqOrigin)
w := httptest.NewRecorder()
handler := Middleware(func(header http.Header) {