Skip to content

Instantly share code, notes, and snippets.

@vkareh
Created Feb 14, 2013
Embed
What would you like to do?
diff --git a/servers/Route.bones.js b/servers/Route.bones.js
index b78dc77..67fc8b5 100644
--- a/servers/Route.bones.js
+++ b/servers/Route.bones.js
@@ -95,7 +95,7 @@ server.prototype.loadCollection = function(req, res, next) {
req.collection = new this.models[name]([], req.query);
var options = {
success: function(collection, resp) {
- res.send(resp, headers);
+ res.send(resp, _.extend(_.result(model, 'headers') || {}, headers));
},
error: function(collection, err) {
var error = err instanceof Object ? err.message : err;
@@ -128,7 +128,7 @@ server.prototype.getModel = function(req, res, next) {
if (!req.model) return next();
var options = {
success: function(model, resp) {
- res.send(resp, headers);
+ res.send(resp, _.extend(_.result(model, 'headers') || {}, headers));
},
error: function(model, err) {
var error = err instanceof Object ? err.message : err;
@@ -146,7 +146,7 @@ server.prototype.saveModel = function(req, res, next) {
if (!req.model) return next();
req.model.save(req.body, {
success: function(model, resp) {
- res.send(resp, headers);
+ res.send(resp, _.extend(_.result(model, 'headers') || {}, headers));
},
error: function(model, err) {
var error = err instanceof Object ? err.message : err;
@@ -162,7 +162,7 @@ server.prototype.delModel = function(req, res, next) {
})) return;
req.model.destroy({
success: function(model, resp) {
- res.send(resp, headers);
+ res.send(resp, _.extend(_.result(model, 'headers') || {}, headers));
},
error: function(model, err) {
var error = err instanceof Object ? err.message : err;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment