Improved Problem Response Content-Type headers #80
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.
Iterates on a change made in the 0.25.0 release where we stopped setting the
Content-Type
header at all to allow the JAX-RS server to do content negotiation properly. However, turns out that in some corner cases this results in aProblem
response being defaulted toapplication/octet-stream
responses which is rarely useful/helpful.Therefore this improves the behaviour to make a best effort to add a recognised
Content-Type
header, when it is compatible with the acceptable content types indicated by the clientsAccept
header. A newtoResponse(HttpHeaders)
overload is added to facilitate this, and existing callers oftoResponse()
updated to call the new method instead.Also greatly expands the test coverage in this area to validate various scenarios around different combinations of
Accept
header, resource@Produces
headers and the resultingContent-Type
header.Related Issues and PRs
SNAPSHOT
build from this branch those errors no longer occur