summaryrefslogtreecommitdiff
path: root/routes
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-07-14 01:39:35 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2012-07-14 01:39:35 +0200
commit1d6204901ccffa029c7beec7ff0fc15ee60a964f (patch)
treef7638e6aef39658fb3614af92b7e108e271e27a1 /routes
parentd549928c12e79bae8069fe5fe4e067ad0c608101 (diff)
downloadcollection-json-explorer-1d6204901ccffa029c7beec7ff0fc15ee60a964f.tar.gz
collection-json-explorer-1d6204901ccffa029c7beec7ff0fc15ee60a964f.tar.bz2
collection-json-explorer-1d6204901ccffa029c7beec7ff0fc15ee60a964f.tar.xz
collection-json-explorer-1d6204901ccffa029c7beec7ff0fc15ee60a964f.zip
o Always showing the returned http response, including body.
Diffstat (limited to 'routes')
-rw-r--r--routes/index.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/routes/index.js b/routes/index.js
index 1edd536..7ae3aa0 100644
--- a/routes/index.js
+++ b/routes/index.js
@@ -115,10 +115,17 @@ exports.write = function(req, res) {
var body = {template: { data: data }};
// console.log('body', JSON.stringify(body));
function done(message, httpResponse) {
+ var parsedBody;
+ try {
+ parsedBody = JSON.parse(httpResponse.body);
+ } catch(e) {}
res.render('data', {
urlgenerator: urlgenerator(req),
url: req.body.url,
- httpResponse: httpResponse
+ root: collection_json.fromObject(parsedBody),
+ httpResponse: httpResponse,
+ parsedBody: parsedBody,
+ rawBody: httpResponse.body
});
}
var httpRequest = http.request(options, function(httpResponse) {
@@ -163,7 +170,8 @@ exports.render = function(req, res) {
params: params,
root: collection_json.fromObject(parsedBody),
httpResponse: httpResponse,
- formattedBody: JSON.stringify(parsedBody, null, ' ')
+ parsedBody: parsedBody,
+ rawBody: httpResponse.body
});
});
};