I want to send plain html instead of a json response for one of my routes in restify. I tried setting the contentType and header property of the response but it doesn’t seem to set the contentType in the header (the browser tries to download the file rather than render it).
res.contentType = 'text/html';
Problem courtesy of: MonkeyBonkey
Quick way to manipulate headers without changing formatters for the whole server:
A restify response object has all the “raw” methods of a node ServerResponse on it as well.
var body = 'hello';
Solution courtesy of: serg