From c04cb305f45e39b71a7bdd51f91e8076eae86481 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Fri, 29 Jun 2012 09:27:22 +0200 Subject: o Showing doc.uri and doc.version. --- routes/index.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'routes') diff --git a/routes/index.js b/routes/index.js index 6910dfa..1a05e39 100644 --- a/routes/index.js +++ b/routes/index.js @@ -13,21 +13,20 @@ exports.render = function(req, res){ accept: 'application/vnd.collection+json' }; var clientReq = http.request(options, function(clientRes) { - console.log('STATUS: ' + clientRes.statusCode); - console.log('HEADERS: ' + JSON.stringify(clientRes.headers)); clientRes.setEncoding('utf8'); - var body = ""; + var body = ''; clientRes.on('data', function (chunk) { body += chunk; }); clientRes.on('end', function (chunk) { - var doc = collection_json.fromObject(JSON.parse(body)); + var parsedBody = JSON.parse(body); + var doc = collection_json.fromObject(parsedBody); res.render('data', { url: req.query.url, doc: doc, headers: clientRes.headers, raw: body, - formattedRaw: JSON.stringify(JSON.parse(body), null, ' ') }); + formattedRaw: JSON.stringify(parsedBody, null, ' ') }); }); }); clientReq.on('error', function() { -- cgit v1.2.3