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
|
||||
}
|
||||
|
||||
qualifiedNames := make([]string, len(config.Chain.Middlewares))
|
||||
for i, name := range config.Chain.Middlewares {
|
||||
qualifiedNames[i] = internal.GetQualifiedName(ctx, name)
|
||||
var qualifiedNames []string
|
||||
for _, name := range config.Chain.Middlewares {
|
||||
qualifiedNames = append(qualifiedNames, internal.GetQualifiedName(ctx, name))
|
||||
}
|
||||
config.Chain.Middlewares = qualifiedNames
|
||||
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) {
|
||||
qualifiedNames := make([]string, len(router.Middlewares))
|
||||
for i, name := range router.Middlewares {
|
||||
qualifiedNames[i] = internal.GetQualifiedName(ctx, name)
|
||||
var qualifiedNames []string
|
||||
for _, name := range router.Middlewares {
|
||||
qualifiedNames = append(qualifiedNames, internal.GetQualifiedName(ctx, name))
|
||||
}
|
||||
router.Middlewares = qualifiedNames
|
||||
rm := m.modifierBuilder.Build(ctx, qualifiedNames)
|
||||
|
|
Loading…
Reference in a new issue