Answer the question
In order to leave comments, you need to log in
Why is not the full body of the response passed to the callback in request?
The callback is called erroneously - it receives error, response and body of the request, while body contains only part of the response, and response.complete is false.
error is null
request({
pool:false,
agent:false,
url:'http://api.example.com/',
method:'POST',
json:true,
form:{user_id:user_id.join(',')}
},function(error,response,body){
...
});
Answer the question
In order to leave comments, you need to log in
The problem was on the side of the requested server - it was cutting off connections ahead of time.
Request means github.com/mikeal/request?
If so, then this is probably some very specific bug due to the sufficient distribution of this module. However, I advise: make sure you use the latest version of the module (boring, but sometimes useful) and since request uses the standard nodejs module for http requests, try to pull the data in an old cool manner
var options = {
pool:false,
agent:false,
url:'http://api.example.com/',
method:'POST',
json:true,
form:{user_id:user_id.join(',')}
};
var req = request(options);
var data = '';
req.on('data', function (chunk) {
data += chunk.toString('utf8');
});
req.on('end', function () {
console.log(data);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question