-
Notifications
You must be signed in to change notification settings - Fork 400
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
text/plain
response body encoding silent failure
#3188
Comments
You are getting no errors because encoding into the body response is turned off, it can leak server details. ("Secure by default") It can be set it though with So if you upgrade to at least RC10, you can add this as an aspect to your route, something like: Check the documentation about the attributes here: On the other hand your code is trying to use a So if you are not sending the |
Are you saying that by default zio-http will only support json encoding but will not support It was not clear from the links you posted if there is a setting to at least print error logs to the console (and not in the response) |
@lemony312 Your direct impl returns a json for |
Describe the bug
I am using the Endpoint definition to accept some body and return a case class.
I defined the schema and some json encoders.
If a user makes a request with
Accept: plain/text
the route will return a 500 with no body.(I had to copy the endpoint code and add log statements to see what the actual error was and it showed that is TextBinary encoder failing - see screenshot)
To Reproduce
Steps to reproduce the behaviour:
$ curl localhost:8080/api/item/id -H 'accept:text/plain'
This will return a 500 with no body (and NO LOGS) on the server.
if you explicity set text plain
then you can curl this way
as a side note, the client sent a list of accept content including application/json
Yet the server decided to pick the first from the list, fail silently, and not retry another content type.
Another note - if you define the route explicitly (not using endpoint) - it will not fail!
Expected behaviour
better: Either a server log or some information
best: Support text/plain automatically
Screenshots
The text was updated successfully, but these errors were encountered: