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
fix: use `aborted` property on http request (nock#1134)
I had some difficulty with this code:
httpRequest.on('timeout', function () {
trackFailure('timeout')
httpRequest.abort()
})
httpRequest.on('error', function (err) {
// Count error if request wasn't aborted due to timeout
if (!httpRequest.aborted) {
trackFailure(err)
}
callback(err)
}
When `nock` was not in use, `trackFailure()` would be called once on
timeout. With `nock` enabled, `trackFailure()` would be called twice
because `httpRequest.aborted` would be undefined.
This change creates and uses the `aborted` property in the same
fashion as the system `http` module.
feat: support URL objects
`url.URL` was added in Node 7 and functions like `http.get()`,
`http.request()` accept URL objects as well as strings as their first
argument. Add support for that to nock.