Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ADDED - Support for custom headers

  • Loading branch information...
commit b46cfc50c372b585fc8f041abe2df0be98ff3f47 1 parent adad1ef
@angelini authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/resty.js
View
9 lib/resty.js
@@ -4,8 +4,13 @@ var path = require('path');
// Utility Functions
var send = exports._send = function(res, response, code) {
- res.setHeader('Content-Type', 'application/json');
- res.statusCode = code || 200;
+ var headers = response.headers || {};
+
+ if (!headers['Content-Type']) {
+ headers['Content-Type'] = 'application/json';
+ }
+
+ res.writeHead(code, headers);
res.write(JSON.stringify(response));
res.end();
};
Please sign in to comment.
Something went wrong with that request. Please try again.