Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Commit

Permalink
prevent errors on larger responses
Browse files Browse the repository at this point in the history
  • Loading branch information
Cherry committed Jun 17, 2014
1 parent 467e97c commit 59a5723
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pointdns.js
Expand Up @@ -125,9 +125,12 @@ app.call = function(status, method, path, callback, data) {
callback( new Error('http error') )
return
}

res.on('data', function(d) {
result = JSON.parse( d )
var responseData = '';
res.on('data', function(chunk) {
responseData += chunk;
});
res.on('end', function(){
result = JSON.parse( responseData )
if ('escape' in data) {
result = result[data['escape']]
} else if ('list_escape' in data) {
Expand All @@ -137,6 +140,7 @@ app.call = function(status, method, path, callback, data) {
})
result = tmp
}
req.end();
callback(null, result)
});
});
Expand Down Expand Up @@ -171,4 +175,3 @@ module.exports = function( setup ) {
}
return app
}

0 comments on commit 59a5723

Please sign in to comment.