mirror of
https://github.com/alibaba/higress.git
synced 2026-04-23 04:57:27 +08:00
feat: e2e test support http body check (#733)
This commit is contained in:
@@ -86,6 +86,76 @@ var WasmPluginsRequestBlock = suite.ConformanceTest{
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
// post blocked body
|
||||
Meta: http.AssertionMeta{
|
||||
TargetBackend: "infra-backend-v1",
|
||||
TargetNamespace: "higress-conformance-infra",
|
||||
},
|
||||
Request: http.AssertionRequest{
|
||||
ActualRequest: http.Request{
|
||||
Host: "foo.com",
|
||||
Path: "/foo",
|
||||
Method: "POST",
|
||||
ContentType: http.ContentTypeTextPlain,
|
||||
Body: []byte(`hello world`),
|
||||
UnfollowRedirect: true,
|
||||
},
|
||||
},
|
||||
Response: http.AssertionResponse{
|
||||
ExpectedResponse: http.Response{
|
||||
StatusCode: 403,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
// check body echoed back in expected request(same as ActualRequest if not set)
|
||||
Meta: http.AssertionMeta{
|
||||
TargetBackend: "infra-backend-v1",
|
||||
TargetNamespace: "higress-conformance-infra",
|
||||
CompareTarget: http.CompareTargetRequest,
|
||||
},
|
||||
Request: http.AssertionRequest{
|
||||
ActualRequest: http.Request{
|
||||
Host: "foo.com",
|
||||
Path: "/foo",
|
||||
Method: "POST",
|
||||
ContentType: http.ContentTypeTextPlain,
|
||||
Body: []byte(`hello higress`),
|
||||
UnfollowRedirect: true,
|
||||
},
|
||||
},
|
||||
Response: http.AssertionResponse{
|
||||
ExpectedResponse: http.Response{
|
||||
StatusCode: 200,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
// check body echoed back in expected response
|
||||
Meta: http.AssertionMeta{
|
||||
TargetBackend: "infra-backend-echo-body-v1",
|
||||
TargetNamespace: "higress-conformance-infra",
|
||||
CompareTarget: http.CompareTargetResponse,
|
||||
},
|
||||
Request: http.AssertionRequest{
|
||||
ActualRequest: http.Request{
|
||||
Host: "foo2.com",
|
||||
Path: "/foo",
|
||||
Method: "POST",
|
||||
ContentType: http.ContentTypeTextPlain,
|
||||
Body: []byte(`hello higress`),
|
||||
UnfollowRedirect: true,
|
||||
},
|
||||
},
|
||||
Response: http.AssertionResponse{
|
||||
ExpectedResponse: http.Response{
|
||||
StatusCode: 200,
|
||||
ContentType: http.ContentTypeTextPlain,
|
||||
Body: []byte(`hello higress`),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
t.Run("WasmPlugins request-block", func(t *testing.T) {
|
||||
for _, testcase := range testcases {
|
||||
|
||||
Reference in New Issue
Block a user