When overriding the 'Content-Type' in a controller, by doing;
response.setHeader("Content-Type", "application/json");
It doesn't actually override, it just appends another header to the response;
Content-Length:23
Content-Type:application/json
Content-Type:text/html
The browser thereby interprets everything as html.