Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot change Content-Type from Groovy policy failure result #9066

Closed
exalate-issue-sync bot opened this issue May 23, 2023 · 0 comments
Closed

Cannot change Content-Type from Groovy policy failure result #9066

exalate-issue-sync bot opened this issue May 23, 2023 · 0 comments

Comments

@exalate-issue-sync
Copy link

exalate-issue-sync bot commented May 23, 2023

Steps to reproduce

  • create an API with keyless plan
  • add Groovy policy to the response with the following script as “on response content script”:
import io.gravitee.policy.groovy.PolicyResult.State

if (request.headers.containsKey('X-Gravitee-Break')) {
response.headers.'X-Groovy-Policy' = 'ko';
result.state = State.FAILURE;
result.code = 500;
result.error = 'Stop request processing due to X-Gravitee-Break header';
result.contentType = 'application/xml';
} else {
response.headers.'X-Groovy-Policy' = 'ok';
}

  • call the API with X-Gravitee-Break header.

Expected result

the response should have application/xml content type.

Actual result

response has application/json content type

Unable to render embedded object: File (/secure/attachment/11623/11623_Screenshot 2023-05-23 at 16.57.23 %282%29.png) not found.

[!/secure/attachment/11623/11623_Screenshot 2023-05-23 at 16.57.23 %282%29.png!|/secure/attachment/11623/11623_Screenshot+2023-05-23+at+16.57.23+%282%29.png]

Linked to https://gravitee.atlassian.net/browse/APIM-1752

and

https://graviteesource.zendesk.com/agent/tickets/6428

mergify bot pushed a commit to gravitee-io/gravitee-api-management that referenced this issue Jun 27, 2023
mergify bot pushed a commit to gravitee-io/gravitee-api-management that referenced this issue Jun 27, 2023
mergify bot pushed a commit to gravitee-io/gravitee-api-management that referenced this issue Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

0 participants