1
0
Fork 0

Merge current v2.11 into v3.0

This commit is contained in:
mmatur 2024-02-08 14:15:45 +01:00
commit bc84fdd006
No known key found for this signature in database
GPG key ID: 2FFE42FC256CFF8E
143 changed files with 8736 additions and 6601 deletions

View file

@ -27,6 +27,8 @@ import (
"github.com/traefik/traefik/v3/pkg/types"
)
const delta float64 = 1e-10
var (
logFileNameSuffix = "/traefik/logger/test.log"
testContent = "Hello, World"
@ -280,7 +282,7 @@ func assertFloat64(exp float64) func(t *testing.T, actual interface{}) {
return func(t *testing.T, actual interface{}) {
t.Helper()
assert.Equal(t, exp, actual)
assert.InDelta(t, exp, actual, delta)
}
}

View file

@ -2,7 +2,7 @@ package addprefix
import (
"context"
"fmt"
"errors"
"net/http"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
@ -33,7 +33,7 @@ func New(ctx context.Context, next http.Handler, config dynamic.AddPrefix, name
name: name,
}
} else {
return nil, fmt.Errorf("prefix cannot be empty")
return nil, errors.New("prefix cannot be empty")
}
return result, nil

View file

@ -2,6 +2,7 @@ package brotli
import (
"bufio"
"errors"
"fmt"
"io"
"mime"
@ -34,11 +35,11 @@ type Config struct {
// NewWrapper returns a new Brotli compressing wrapper.
func NewWrapper(cfg Config) (func(http.Handler) http.HandlerFunc, error) {
if cfg.MinSize < 0 {
return nil, fmt.Errorf("minimum size must be greater than or equal to zero")
return nil, errors.New("minimum size must be greater than or equal to zero")
}
if len(cfg.ExcludedContentTypes) > 0 && len(cfg.IncludedContentTypes) > 0 {
return nil, fmt.Errorf("excludedContentTypes and includedContentTypes options are mutually exclusive")
return nil, errors.New("excludedContentTypes and includedContentTypes options are mutually exclusive")
}
var excludedContentTypes []parsedContentType

View file

@ -2,6 +2,7 @@ package compress
import (
"context"
"errors"
"fmt"
"mime"
"net/http"
@ -38,7 +39,7 @@ func New(ctx context.Context, next http.Handler, conf dynamic.Compress, name str
middlewares.GetLogger(ctx, name, typeName).Debug().Msg("Creating middleware")
if len(conf.ExcludedContentTypes) > 0 && len(conf.IncludedContentTypes) > 0 {
return nil, fmt.Errorf("excludedContentTypes and includedContentTypes options are mutually exclusive")
return nil, errors.New("excludedContentTypes and includedContentTypes options are mutually exclusive")
}
excludes := []string{"application/grpc"}