Node-request - How to determine if an error occurred during the request?

前端 未结 4 1900
栀梦
栀梦 2020-12-24 12:20

I\'m trying to leverage the node-request module, but the documentation isn\'t that great. If I make a request to a valid resource and pipe it to a Writable Stream, everythin

4条回答
  •  难免孤独
    2020-12-24 12:39

    i wrote request :)

    you might want to try this

    var r = request(url)
    r.on('response', function (resp) {
       resp.headers 
       resp.statusCode
       r.pipe(new WritableStream())
    })
    

提交回复
热议问题