This commit is contained in:
Josh Harvey 2014-07-04 19:39:52 -04:00
parent 3601a6ec12
commit 0db7fbcde0
3 changed files with 18 additions and 6 deletions

View file

@ -2,7 +2,7 @@
var ApiResponse = function(config) {
this.config = config;
this.reponse = config.response;
this.response = config.response;
this.targetVersion = config.targetVersion;
this.version = config.version;
};
@ -16,7 +16,8 @@ module.exports = ApiResponse;
ApiResponse.prototype.respond = function respond(err, res, statusCodeOpt) {
var statusCode = statusCodeOpt || 200;
if (err) return this.response.json(statusCode, this._buildErr(err));
this.response.json(statusCode, this._buildResponse(res));
var jsonResponse = this._buildResponse(res);
this.response.json(statusCode, jsonResponse);
};
ApiResponse.prototype._buildErr = function _buildErr(err) {