Merge current v2.11 into v3.0
This commit is contained in:
commit
05be441027
156 changed files with 5826 additions and 8436 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/containous/alice"
|
||||
|
@ -99,7 +100,7 @@ func checkRecursion(ctx context.Context, middlewareName string) (context.Context
|
|||
if !ok {
|
||||
currentStack = []string{}
|
||||
}
|
||||
if inSlice(middlewareName, currentStack) {
|
||||
if slices.Contains(currentStack, middlewareName) {
|
||||
return ctx, fmt.Errorf("could not instantiate middleware %s: recursion detected in %s", middlewareName, strings.Join(append(currentStack, middlewareName), "->"))
|
||||
}
|
||||
return context.WithValue(ctx, middlewareStackKey, append(currentStack, middlewareName)), nil
|
||||
|
@ -392,12 +393,3 @@ func (b *Builder) buildConstructor(ctx context.Context, middlewareName string) (
|
|||
// this would not enable tracing.
|
||||
return observability.WrapMiddleware(ctx, middleware), nil
|
||||
}
|
||||
|
||||
func inSlice(element string, stack []string) bool {
|
||||
for _, value := range stack {
|
||||
if value == element {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue