forked from Ivasoft/traefik
Don't panic with undefined middleware
This commit is contained in:
committed by
Traefiker Bot
parent
a917115a85
commit
10acbb8d92
@@ -47,7 +47,7 @@ func TestBuilderBuild(t *testing.T) {
|
||||
assertResponse: func(t *testing.T, resp *http.Response) {
|
||||
t.Helper()
|
||||
|
||||
assert.Equal(t, resp.Header.Get("X-Foo"), "foo")
|
||||
assert.Equal(t, "foo", resp.Header.Get("X-Foo"))
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -85,7 +85,7 @@ func TestBuilderBuild(t *testing.T) {
|
||||
assertResponse: func(t *testing.T, resp *http.Response) {
|
||||
t.Helper()
|
||||
|
||||
assert.Equal(t, resp.Header.Get("Referrer-Policy"), "no-referrer")
|
||||
assert.Equal(t, "no-referrer", resp.Header.Get("Referrer-Policy"))
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -107,8 +107,8 @@ func TestBuilderBuild(t *testing.T) {
|
||||
assertResponse: func(t *testing.T, resp *http.Response) {
|
||||
t.Helper()
|
||||
|
||||
assert.Equal(t, resp.Header.Get("X-Foo"), "foo")
|
||||
assert.Equal(t, resp.Header.Get("X-Bar"), "bar")
|
||||
assert.Equal(t, "foo", resp.Header.Get("X-Foo"))
|
||||
assert.Equal(t, "bar", resp.Header.Get("X-Bar"))
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -130,7 +130,7 @@ func TestBuilderBuild(t *testing.T) {
|
||||
assertResponse: func(t *testing.T, resp *http.Response) {
|
||||
t.Helper()
|
||||
|
||||
assert.Equal(t, resp.Header.Get("X-Foo"), "foo")
|
||||
assert.Equal(t, "foo", resp.Header.Get("X-Foo"))
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -157,9 +157,18 @@ func TestBuilderBuild(t *testing.T) {
|
||||
assertResponse: func(t *testing.T, resp *http.Response) {
|
||||
t.Helper()
|
||||
|
||||
assert.Equal(t, resp.Header.Get("X-Foo"), "foo")
|
||||
assert.Equal(t, "foo", resp.Header.Get("X-Foo"))
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "nil middleware",
|
||||
middlewares: []string{"foo"},
|
||||
buildResponse: stubResponse,
|
||||
conf: map[string]*dynamic.Middleware{
|
||||
"foo": nil,
|
||||
},
|
||||
assertResponse: func(t *testing.T, resp *http.Response) {},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range testCases {
|
||||
|
||||
Reference in New Issue
Block a user