-
Notifications
You must be signed in to change notification settings - Fork 7k
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
404 errors with APIv4 has incorrect content-type header #20878
Comments
Great catch @NicolasCARPi ! This is happening because the 404 handler is not wrapped in web.Handler which adds the If you are feeling up to it, please do send a PR, and we'll be happy to take a look. |
Sorry I am not familiar enough with the codebase to try and fix that by myself :/ |
@amyblais - Let's create this issue itself as an HW ticket. I will close the JIRA issue. |
Can I take on this issue? |
Go ahead @clementbowe14 ! |
@agnivade |
Version used: 6.6.2 in Docker.
Summary
The 404 response sent by apiv4 have a content-type header of
text/plain; charset=utf-8
instead ofapplication/json
. But the documentation states that all responses areapplication/json
.Steps to reproduce
Access an invalid api endpoint or none at all:
Expected behavior
The response header
content-type
should beapplication/json
and the response should be displayed in the browser as json (firefox pretty prints json responses).Observed behavior (that appears unintentional)
The error message is displayed as text instead of being interpreted as JSON.
![2022-08-25-030755_524x80_scrot](https://user-images.githubusercontent.com/3043706/186551251-74909eaa-e6e0-4340-b0e8-043337ae71af.png)
Possible fixes
Ensure 404 handler sends correct headers, unless of course this is intentional design, in which case I would be interested in knowing the reason ;)
Thanks for the great software everyone and have a terrific day! 🚀
The text was updated successfully, but these errors were encountered: