Add test with many endpoints
This commit is contained in:
parent
f2ae922024
commit
bbab13a995
1 changed files with 34 additions and 0 deletions
|
@ -282,6 +282,40 @@ rules:
|
|||
},
|
||||
expected: result{code: http.StatusForbidden, body: "Forbidden"},
|
||||
},
|
||||
{
|
||||
name: "many-rules-forbidden",
|
||||
conf: `
|
||||
rules:
|
||||
- endpoint: "/list"
|
||||
forbidden_response_re:
|
||||
- '.*admin.*'
|
||||
- endpoint: "/dump"
|
||||
max_response_length_bytes: 4
|
||||
`,
|
||||
service: echoService,
|
||||
makeRequest: func() *resty.Request {
|
||||
return c.R().SetBody(`hello`)
|
||||
},
|
||||
endpoint: "/dump",
|
||||
expected: result{code: http.StatusForbidden, body: "Forbidden"},
|
||||
},
|
||||
{
|
||||
name: "many-rules-ok",
|
||||
conf: `
|
||||
rules:
|
||||
- endpoint: "/list"
|
||||
forbidden_response_re:
|
||||
- '.*admin.*'
|
||||
- endpoint: "/dump"
|
||||
max_response_length_bytes: 4
|
||||
`,
|
||||
service: echoService,
|
||||
makeRequest: func() *resty.Request {
|
||||
return c.R().SetBody(`hello`)
|
||||
},
|
||||
endpoint: "/list",
|
||||
expected: result{code: http.StatusOK, body: "hello"},
|
||||
},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
service := httptest.NewServer(tc.service)
|
||||
|
|
Loading…
Reference in a new issue