Merge branch v2.11 into v3.1

This commit is contained in:
kevinpollet 2024-10-28 10:32:18 +01:00
commit 20cdbdbf31
No known key found for this signature in database
GPG key ID: 0C9A5DDD1B292453
4 changed files with 152 additions and 16 deletions

View file

@ -25,7 +25,6 @@ import (
"github.com/stretchr/testify/require"
ptypes "github.com/traefik/paerser/types"
"github.com/traefik/traefik/v3/pkg/middlewares/capture"
"github.com/traefik/traefik/v3/pkg/middlewares/recovery"
"github.com/traefik/traefik/v3/pkg/types"
)
@ -954,8 +953,14 @@ func doLoggingWithAbortedStream(t *testing.T, config *types.AccessLog) {
req = req.WithContext(reqContext)
chain := alice.New()
chain = chain.Append(func(next http.Handler) (http.Handler, error) {
return recovery.New(context.Background(), next)
return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
defer func() {
_ = recover() // ignore the stream backend panic to avoid the test to fail.
}()
next.ServeHTTP(rw, req)
}), nil
})
chain = chain.Append(capture.Wrap)
chain = chain.Append(WrapHandler(logger))