I have this simple piece of code that I adapted from the official documentation:
const request = net.request(apiUri + '/' + action);
request.on('response', (response) => {
var body = '';
response.on('data', (chunk) => {
body += chunk;
console.log('response data');
});
response.on('end', () => {
console.log('response end');
//body = JSON.parse(body);
});
});
request.on('error', (e) => {
console.log('Error: ' + e.message);
});
request.on('end', () => {
console.log('request end');
});
request.end();
But I only see "response data" and nothing else. Request is not ending, not giving an error.. wtf?
via Elfy
No comments:
Post a Comment