summaryrefslogtreecommitdiff
path: root/routes
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-07-29 20:22:56 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2012-07-29 20:22:56 +0200
commit5fb708a874ea85f483f272ad29f78d45c7bf5526 (patch)
treeff7ac53e477c1c4f7fe183791a152e2027d4e189 /routes
parent9ae22f10ce3cbcfad91668ca7234058c0a55550f (diff)
downloadcollection-json-explorer-5fb708a874ea85f483f272ad29f78d45c7bf5526.tar.gz
collection-json-explorer-5fb708a874ea85f483f272ad29f78d45c7bf5526.tar.bz2
collection-json-explorer-5fb708a874ea85f483f272ad29f78d45c7bf5526.tar.xz
collection-json-explorer-5fb708a874ea85f483f272ad29f78d45c7bf5526.zip
data.jade: Making sure 'params' is always available.HEADmaster
Diffstat (limited to 'routes')
-rw-r--r--routes/index.js8
1 files changed, 4 insertions, 4 deletions
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) {