Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
called = true
clearTimeout(id)
if (!(err instanceof Error)) {
res = err
err = null
}
// kill the request, specifically for timeouts
// to do: tests for this #7
if (err) req.abort()
if (retries && (err
|| (res && status.retry[res.statusCode])
)) {
debug('retrying %s %s', o.method, o.href)
retries--
resolve(request())
} else if (err) {
debug('received error "%s" with "%s"', err.message, o.href)
reject(err)
} else {
resolve(res)
}
}
})