Try harder to return response in the same type as the request.
We still heed the `accept' header to choose the preferred content type of
the answer, but if it is missing, instead of defaulting to plain text, we
try to match the content type of the request.
This means that errors to json requests will now always get returned as
json, unless the `accept' header requires a different type.