This repository was archived by the owner on Dec 13, 2018. It is now read-only.
Fix/default response content type #563
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Update the controller responses (via
handleAcceptRequests) to useconfig.web.produces[0]as the default, instead oftext/html, if this array is defined (if not, it will explode in a later step, anyway). Adds tests to check for this behaviour, and some of the other behaviour of that helper, while I was at it.While the commits thus far do not deal with this, it might be prudent to exchange the
nextdefault handlers (which result in a404) with something like400 Bad Requestdefault handlers, which is something like what @rdegges mentioned in #487 . A not found is not really semantically correct. @robertjd, thoughts regarding this?Another important thing to note is that this is a breaking change - a good number of our tests failed because they expected it to default to
text/html. This can be solved by either defining a['text/html', 'application/json']value to theconfig.web.producesarray, or by explicitly setting theAcceptheader. So far, it was exactly the reverse (explicit setting toapplication/jsonwas required).Fixes #487