Fix panic when using chain middleware.
This commit is contained in:
parent
a55f0cabdd
commit
b10cb84f33
2 changed files with 19 additions and 1 deletions
|
@ -45,7 +45,10 @@ func (f *Builder) Build(ctx context.Context, names []string) func(*http.Response
|
||||||
for _, name := range conf.Chain.Middlewares {
|
for _, name := range conf.Chain.Middlewares {
|
||||||
qualifiedNames = append(qualifiedNames, provider.GetQualifiedName(chainCtx, name))
|
qualifiedNames = append(qualifiedNames, provider.GetQualifiedName(chainCtx, name))
|
||||||
}
|
}
|
||||||
modifiers = append(modifiers, f.Build(ctx, qualifiedNames))
|
|
||||||
|
if rm := f.Build(ctx, qualifiedNames); rm != nil {
|
||||||
|
modifiers = append(modifiers, rm)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -169,6 +169,21 @@ func TestBuilderBuild(t *testing.T) {
|
||||||
},
|
},
|
||||||
assertResponse: func(t *testing.T, resp *http.Response) {},
|
assertResponse: func(t *testing.T, resp *http.Response) {},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
desc: "chain without headers",
|
||||||
|
middlewares: []string{"chain"},
|
||||||
|
buildResponse: stubResponse,
|
||||||
|
conf: map[string]*dynamic.Middleware{
|
||||||
|
"foo": {IPWhiteList: &dynamic.IPWhiteList{}},
|
||||||
|
"chain": {
|
||||||
|
Chain: &dynamic.Chain{
|
||||||
|
Middlewares: []string{"foo"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
assertResponse: func(t *testing.T, resp *http.Response) {},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
|
|
Loading…
Reference in a new issue