Do not initialize list of middlewares if not needed
Co-authored-by: Ludovic Fernandez <ldez@users.noreply.github.com>
This commit is contained in:
parent
b16ebd529b
commit
6f6f999129
2 changed files with 6 additions and 6 deletions
|
@ -142,9 +142,9 @@ func (b *Builder) buildConstructor(ctx context.Context, middlewareName string) (
|
||||||
return nil, badConf
|
return nil, badConf
|
||||||
}
|
}
|
||||||
|
|
||||||
qualifiedNames := make([]string, len(config.Chain.Middlewares))
|
var qualifiedNames []string
|
||||||
for i, name := range config.Chain.Middlewares {
|
for _, name := range config.Chain.Middlewares {
|
||||||
qualifiedNames[i] = internal.GetQualifiedName(ctx, name)
|
qualifiedNames = append(qualifiedNames, internal.GetQualifiedName(ctx, name))
|
||||||
}
|
}
|
||||||
config.Chain.Middlewares = qualifiedNames
|
config.Chain.Middlewares = qualifiedNames
|
||||||
middleware = func(next http.Handler) (http.Handler, error) {
|
middleware = func(next http.Handler) (http.Handler, error) {
|
||||||
|
|
|
@ -143,9 +143,9 @@ func (m *Manager) buildRouterHandler(ctx context.Context, routerName string, rou
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Manager) buildHTTPHandler(ctx context.Context, router *runtime.RouterInfo, routerName string) (http.Handler, error) {
|
func (m *Manager) buildHTTPHandler(ctx context.Context, router *runtime.RouterInfo, routerName string) (http.Handler, error) {
|
||||||
qualifiedNames := make([]string, len(router.Middlewares))
|
var qualifiedNames []string
|
||||||
for i, name := range router.Middlewares {
|
for _, name := range router.Middlewares {
|
||||||
qualifiedNames[i] = internal.GetQualifiedName(ctx, name)
|
qualifiedNames = append(qualifiedNames, internal.GetQualifiedName(ctx, name))
|
||||||
}
|
}
|
||||||
router.Middlewares = qualifiedNames
|
router.Middlewares = qualifiedNames
|
||||||
rm := m.modifierBuilder.Build(ctx, qualifiedNames)
|
rm := m.modifierBuilder.Build(ctx, qualifiedNames)
|
||||||
|
|
Loading…
Add table
Reference in a new issue