You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
im porting some request code over that looks like this
req.on('response', handle)
in request, handle gets called when the 'final' redirect gets called, so e.g. if the first response was actually a 302, and the 2nd one is the a 200, only the 200 response will be emitted as the response event.
in got, response is emitted each time their is a response, because if this line is truthy multiple times, the recursive call in there causes it to emit many times
the problem I have is that I only care about the last response, but there doesn't seem to be an event for that, but maybe i'm missing something!
The text was updated successfully, but these errors were encountered:
var isRedirect = require('is-redirect')
request.on('response', function(res) {
if (isRedirect(res.statusCode)) return // hack for https://github.com/sindresorhus/got/issues/75
// handle final response here
}
im porting some request code over that looks like this
in request,
handle
gets called when the 'final' redirect gets called, so e.g. if the first response was actually a 302, and the 2nd one is the a 200, only the 200 response will be emitted as theresponse
event.in got,
response
is emitted each time their is a response, because if this line is truthy multiple times, the recursive call in there causes it to emit many timesthe problem I have is that I only care about the last response, but there doesn't seem to be an event for that, but maybe i'm missing something!
The text was updated successfully, but these errors were encountered: