1
0
Fork 0

Bump to go1.24

Co-authored-by: Romain <rtribotte@users.noreply.github.com>
This commit is contained in:
Kevin Pollet 2025-06-02 10:36:05 +02:00 committed by GitHub
parent 5f35c88805
commit cd16321dd9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
88 changed files with 284 additions and 362 deletions

View file

@ -3,7 +3,6 @@ package headers
// Middleware tests based on https://github.com/unrolled/secure
import (
"context"
"io"
"net/http"
"net/http/httptest"
@ -20,7 +19,7 @@ import (
func TestNew_withoutOptions(t *testing.T) {
next := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) })
mid, err := New(context.Background(), next, dynamic.Headers{}, "testing")
mid, err := New(t.Context(), next, dynamic.Headers{}, "testing")
require.Errorf(t, err, "headers configuration not valid")
assert.Nil(t, mid)
@ -55,7 +54,7 @@ func TestNew_allowedHosts(t *testing.T) {
AllowedHosts: []string{"foo.com", "bar.com"},
}
mid, err := New(context.Background(), emptyHandler, cfg, "foo")
mid, err := New(t.Context(), emptyHandler, cfg, "foo")
require.NoError(t, err)
for _, test := range testCases {
@ -86,7 +85,7 @@ func TestNew_customHeaders(t *testing.T) {
},
}
mid, err := New(context.Background(), next, cfg, "testing")
mid, err := New(t.Context(), next, cfg, "testing")
require.NoError(t, err)
req := httptest.NewRequest(http.MethodGet, "/foo", nil)
@ -134,7 +133,7 @@ func Test1xxResponses(t *testing.T) {
},
}
mid, err := New(context.Background(), next, cfg, "testing")
mid, err := New(t.Context(), next, cfg, "testing")
require.NoError(t, err)
server := httptest.NewServer(mid)
@ -178,7 +177,7 @@ func Test1xxResponses(t *testing.T) {
return nil
},
}
req, _ := http.NewRequestWithContext(httptrace.WithClientTrace(context.Background(), trace), http.MethodGet, server.URL, nil)
req, _ := http.NewRequestWithContext(httptrace.WithClientTrace(t.Context(), trace), http.MethodGet, server.URL, nil)
res, err := frontendClient.Do(req)
assert.NoError(t, err)