user6564357 user6564357 - 2 months ago 14
HTTP Question

NodeJS Request throw [Error: read ECONNRESET] when make http call

when use Request TCP always REST, but use node native http module is fine.

var request = require('request');
var http = require('http');

request.get('',function(err, res,body){

console.log(err, res); // [Error: read ECONNRESET]


http.get('', function(res) {

console.log(res.statusCode); // 200 all right


how to fixed it ?

        originalHostHeaderName: 'Host'
    function(err, res,body){
        console.log(err, res); 

this site header 'Host' must be Initials.