Hello!
Is it possible to to send correct mime type for errors in serve code?
I have to use XMLHttpRequest and forward its response to client. For error it returns good response code (like 404) and error body as JSON object:
var xhrResponse = XHR.send(..);
// xhrResponse.body is {"description":"User 'xxx' does not exist.","code":"DBUI110"}"
// xhrResponse.status is 404
response.error(xhrResponse .body, xhrResponse .status);
This produces response with code 404, specified body AND mime type /
Firefox says "not well formed" and doesn't work properly because it expects mime type to be "application/json" for this particular body.
How could I send correct mime type with error response? Or in general - a responce with specific body, code and headers?