From 5fb708a874ea85f483f272ad29f78d45c7bf5526 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 29 Jul 2012 20:22:56 +0200 Subject: data.jade: Making sure 'params' is always available. --- routes/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'routes') diff --git a/routes/index.js b/routes/index.js index fff06b6..8475824 100644 --- a/routes/index.js +++ b/routes/index.js @@ -117,15 +117,15 @@ exports.write = function(req, res) { options.headers = { 'Content-Type': 'application/vnd.collection+json' }; -// console.log('options', options); + // console.log('options', options); -// console.log('params', extractParams(req.body)); var data = _.map(extractParams(req.body), function(value, key) { return {name: key, value: value}; }); var body = {template: { data: data }}; -// console.log('body', JSON.stringify(body)); + // console.log('body', JSON.stringify(body, null, ' ')); function done(message, httpResponse) { + // console.log('done', arguments); var parsedBody; try { parsedBody = JSON.parse(httpResponse.body); @@ -136,7 +136,7 @@ exports.write = function(req, res) { root: collection_json.fromObject(parsedBody), httpResponse: httpResponse, parsedBody: parsedBody, - rawBody: httpResponse.body + rawBody: typeof httpResponse == 'object' ? httpResponse.body : undefined, }); } var httpRequest = http.request(options, function(httpResponse) { -- cgit v1.2.3