Set headers with set method
This commit is contained in:
@@ -149,18 +149,18 @@ BaseController.prototype.req2params = function(req, callback){
|
||||
};
|
||||
// jshint maxcomplexity:6
|
||||
|
||||
|
||||
BaseController.prototype.send = function(req, res, args) {
|
||||
if (global.environment && global.environment.api_hostname) {
|
||||
res.header('X-Served-By-Host', global.environment.api_hostname);
|
||||
}
|
||||
|
||||
if (req.params && req.params.dbhost) {
|
||||
res.header('X-Served-By-DB-Host', req.params.dbhost);
|
||||
// jshint maxcomplexity:9
|
||||
BaseController.prototype.send = function(req, res, body, status, headers) {
|
||||
if (req.params.dbhost) {
|
||||
res.set('X-Served-By-DB-Host', req.params.dbhost);
|
||||
}
|
||||
|
||||
if (req.profiler) {
|
||||
res.header('X-Tiler-Profiler', req.profiler.toJSONString());
|
||||
res.set('X-Tiler-Profiler', req.profiler.toJSONString());
|
||||
}
|
||||
|
||||
if (headers) {
|
||||
res.set(headers);
|
||||
}
|
||||
|
||||
res.send.apply(res, args);
|
||||
@@ -175,6 +175,7 @@ BaseController.prototype.send = function(req, res, args) {
|
||||
}
|
||||
}
|
||||
};
|
||||
// jshint maxcomplexity:6
|
||||
|
||||
BaseController.prototype.sendError = function(req, res, err, label) {
|
||||
label = label || 'UNKNOWN';
|
||||
@@ -204,7 +205,7 @@ BaseController.prototype.sendError = function(req, res, err, label) {
|
||||
|
||||
var errorResponseBody = { errors: [message] };
|
||||
|
||||
this.send(req, res, [errorResponseBody, statusCode]);
|
||||
this.send(req, res, errorResponseBody, statusCode);
|
||||
};
|
||||
|
||||
function findStatusCode(err) {
|
||||
|
||||
Reference in New Issue
Block a user