Force errors to be JSON
The http server library decides automatically if errors should be returned as formatted HTML or as JSON. This decision is made in http_json:prefer_json/1
.
We always want JSON returns. However, we may get HTML returns, for example if the request does not contain an Accept
header. Can we force the library to return JSON?