-
Notifications
You must be signed in to change notification settings - Fork 367
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
Fix Improper 406 Responses #1540
Conversation
Folks, I wanted to present this PR as a discussion on fixing the issue with the There is a lot to clean up in the code. For example, if we keep However, is the general solution to the problem adequate? The original problem that the tests surface is that we have an error handler ( If this gets a thumbs up I can clean up this code and, hopefully, get all the other tests to pass. P.S. I forgot to mention that this only fixes the |
Playing devil's advocate: what about instead including a fall-back representation for when there is no matching content type? This could be handled exclusively in the |
@snoyberg Please take a look at the current solution. It seems to me that the problem is that It seems to me that this behavior was added in this commit. The reason I felt comfortable changing that work is:
Tagging @gregwebs to get his thoughts on this as well. Happy to take directions on this from the team, but this seemed like a correct, clean change. |
I'm OK with heading in this direction. It seems like perhaps we should have a separate function like But a change like this certainly needs to be called out clearly in the ChangeLog. |
The `selectRep` documentation indicates that it choose the first representation provided if no representation matches. This was only partially correct, as `selectRep` required that no representation matched **and** that the `Content-Type` header of the response was empty. This led to a problem because `defaultErrorhandler` relies on `selectRep`, and when `selectRep` was unable to find a suitable representation, it would "swallow" the original error that resulted in `defaultErrorhandler` being called, and set a status 406 for all cases.
@snoyberg take a look now please. Feedback welcomed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, merge when ready 👍
Before submitting your PR, check that you've:
After submitting your PR: