-
Notifications
You must be signed in to change notification settings - Fork 566
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
Error handling of invalid content-type #7053
Comments
To create a custom response for "pre-routing" errors, such as bad request, you can add a You direct hanlder will get as much information as could be retrieved from the request, and you can create a customized response to be sent back. |
For the part about not seeing the error in your logs, could you share the stacktrace of that exception please (I plan to split it into a new issue, so if you are OK with creating a new issue specifically for the error in the logs, it would be nice). Thanks |
Here is full stack:
|
Example of a direct handler that maps bad requests to not found:
The exception is still written to the log, As that error is handled elsewhere, the message should not be printed. I will create an issue for it. |
Submitted an issue for the logging problem. I will close this one as I have answered how to customize the response for bad requests. |
Environment Details
Problem Description
Sending POST request with invalid content-type
%{bad actor}
Leads to
java.lang.IllegalArgumentException
in the server log and on the client side the observed behaviour is:Could not parse '%{bad actor}'
Expected behaviour
We would like to:
Unexpected error occurred during routing!
exception in our server logIs that currently possible? If not, can this be added?
The text was updated successfully, but these errors were encountered: