node.js - nodejs https response is not received -


i'm using nodejs on windows 7. i'm experiencing strange behavior. same https request gives same response of time not received node whereas received web browser.

the code quite simple:

var url1 = 'https:<my url>' require('request').get(url1).pipe(process.stdout) 

the response chunked response, big json object.

if try request on browser, receive anwser. if use node request module (i tried https), body of time empty. returned.

i receive status 200 , response headers are:

{ 'content-type': 'application/json',   connection: 'close',   'transfer-encoding': 'chunked',   date: 'wed, 27 jan 2016 21:01:59 gmt',   server: 'my server' } 

any idea?

i found 2 solutions fix issue:

1) set header 'connection': 'keep-alive'

var opts = { url: 'my url', headers :{ 'connection':'keep-alive'} } request(opts).pipe(..) 

2) set true keepalive option in https.globalagent

https.globalagent.keepalive=true 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -