-
Notifications
You must be signed in to change notification settings - Fork 563
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
Unexpected Content-Type when setting return_error_code and return_error_msg #707
Comments
Hi @bfoosness |
Amazing! Thank you, @taik0 |
Thank you for closing, @taik0. I haven't been able to verify the fix yet, but I'm hopeful this will address it. Do you know when the next release will be for https://hub.docker.com/r/devopsfaith/krakend/tags? |
Hi @bfoosness, |
Many thanks, @alombarte! I confirmed that this fix is working as intended. |
This issue was marked as resolved a long time ago and now has been automatically locked as there has not been any recent activity after it. You can still open a new issue and reference this link. |
Describe the bug
I've combed through the documentation looking for an explanation or misconfiguration on my part, so my apologies if this is expected. I'm trying to implement this strategy:
https://www.krakend.io/docs/backends/detailed-errors/#return-the-http-status-code-of-a-single-backend
I have added the following configuration to my endpoint's backend, and I have added
"return_error_msg": true
to my router configuration.I do indeed see the HTTP status code and error body of my backend returned after adding this configuration. However, the
Content-Type
of the response istext/plain
for any non-2xx responses instead ofapplication/json
like I would expect. For 2xx responses,Content-Type
isapplication/json
as expected.My understanding is that the default
output_encoding
isjson
, and I do not override that anywhere. I've tried explicitly setting theoutput_encoding
tojson
on the endpoint and setting theencoding
tojson
in the endpoint's backend configuration, but so far I've had no luck in getting the content-type to return asapplication/json
.Is this expected or a bug? Is there any way to force non-2xx responses to use
application/json
when usingreturn_error_code
andreturn_error_msg
?Expected behavior
Both 2xx and non-2xx responses use
Content-Type: application/json
when setting"return_error_code": true
and"return_error_msg": true
.Thank you for reviewing!
The text was updated successfully, but these errors were encountered: