diff --git a/test/cucumber-tests/src/test/resources/artifacts/apk-confs/request_and_response_filters.apk-conf b/test/cucumber-tests/src/test/resources/artifacts/apk-confs/request_and_response_filters.apk-conf new file mode 100644 index 0000000000..a41f67efcf --- /dev/null +++ b/test/cucumber-tests/src/test/resources/artifacts/apk-confs/request_and_response_filters.apk-conf @@ -0,0 +1,64 @@ +--- +id: "api-with-request-and-response-filters" +name: "EmployeeServiceAPI" +basePath: "/request-and-response-filters" +version: "3.14" +type: "REST" +defaultVersion: false +endpointConfigurations: + production: + endpoint: "http://backend:80/anything" +operations: + - target: "/employee" + verb: "GET" + secured: false + scopes: [] + operationPolicies: + request: + - policyName: AddHeaders + policyVersion: v1 + parameters: + headers: + - name: "Test-Request-Header" + value: "Test-Value" + - policyName: SetHeaders + policyVersion: v1 + parameters: + headers: + - name: "Set-Request-Header" + value: "Test-Value" + - policyName: RemoveHeaders + policyVersion: v1 + parameters: + headers: + - "Authorization" + response: + - policyName: AddHeaders + policyVersion: v1 + parameters: + headers: + - name: "Test-Response-Header" + value: "Test-Value" + - policyName: SetHeaders + policyVersion: v1 + parameters: + headers: + - name: "Set-Response-Header" + value: "Test-Value" + - policyName: RemoveHeaders + policyVersion: v1 + parameters: + headers: + - "content-type" + - target: "/employee" + verb: "POST" + secured: true + scopes: [] + - target: "/employee/{employeeId}" + verb: "PUT" + secured: true + scopes: [] + - target: "/employee/{employeeId}" + verb: "DELETE" + secured: true + scopes: [] diff --git a/test/cucumber-tests/src/test/resources/tests/api/HTTPRouteFilters.feature b/test/cucumber-tests/src/test/resources/tests/api/HTTPRouteFilters.feature new file mode 100644 index 0000000000..e8138c5b51 --- /dev/null +++ b/test/cucumber-tests/src/test/resources/tests/api/HTTPRouteFilters.feature @@ -0,0 +1,28 @@ +Feature: Test HTTPRoute Filter Header Modifier functionality + Scenario: Test request and response header modification functionality + Given The system is ready + And I have a valid subscription + When I use the APK Conf file "artifacts/apk-confs/request_and_response_filters.apk-conf" + And the definition file "artifacts/definitions/employees_api.json" + And make the API deployment request + Then the response status code should be 200 + Then I set headers + | Authorization | bearer ${accessToken} | + And I send "GET" request to "https://default.gw.wso2.com:9095/request-and-response-filters/3.14/employee/" with body "" + And I eventually receive 200 response code, not accepting + | 401 | + And the response body should contain "\"Test-Request-Header\": \"Test-Value\"" + And the response body should contain "\"Set-Request-Header\": \"Test-Value\"" + And the response body should not contain "\"Authorization\"" + Then the response headers contains key "Set-Response-Header" and value "Test-Value" + Then the response headers contains key "Test-Response-Header" and value "Test-Value" + And the response headers should not contain + | content-type | + + Scenario: Undeploy the API + Given The system is ready + And I have a valid subscription + When I undeploy the API whose ID is "api-with-request-and-response-filters" + Then the response status code should be 202 + + \ No newline at end of file