(err, { state: state2, opts }, cb)
| 58131 | abort(this.reason); |
| 58132 | } else { |
| 58133 | this.abort = abort; |
| 58134 | } |
| 58135 | } |
| 58136 | onBodySent(chunk) { |
| 58137 | if (this.handler.onBodySent) return this.handler.onBodySent(chunk); |
| 58138 | } |
| 58139 | static [kRetryHandlerDefaultRetry](err, { state: state2, opts }, cb) { |
| 58140 | const { statusCode, code, headers } = err; |
| 58141 | const { method, retryOptions } = opts; |
| 58142 | const { |
| 58143 | maxRetries, |
| 58144 | timeout, |
| 58145 | maxTimeout, |
| 58146 | timeoutFactor, |
| 58147 | statusCodes, |
| 58148 | errorCodes, |
| 58149 | methods |
| 58150 | } = retryOptions; |
| 58151 | let { counter, currentTimeout } = state2; |
| 58152 | currentTimeout = currentTimeout != null && currentTimeout > 0 ? currentTimeout : timeout; |
| 58153 | if (code && code !== "UND_ERR_REQ_RETRY" && code !== "UND_ERR_SOCKET" && !errorCodes.includes(code)) { |
| 58154 | cb(err); |
| 58155 | return; |
| 58156 | } |
| 58157 | if (Array.isArray(methods) && !methods.includes(method)) { |
| 58158 | cb(err); |
| 58159 | return; |
| 58160 | } |
| 58161 | if (statusCode != null && Array.isArray(statusCodes) && !statusCodes.includes(statusCode)) { |
| 58162 | cb(err); |
| 58163 | return; |
| 58164 | } |
| 58165 | if (counter > maxRetries) { |
| 58166 | cb(err); |
| 58167 | return; |
| 58168 | } |
| 58169 | let retryAfterHeader = headers != null && headers["retry-after"]; |
| 58170 | if (retryAfterHeader) { |
| 58171 | retryAfterHeader = Number(retryAfterHeader); |
| 58172 | retryAfterHeader = isNaN(retryAfterHeader) ? calculateRetryAfterHeader(retryAfterHeader) : retryAfterHeader * 1e3; |
| 58173 | } |
| 58174 | const retryTimeout = retryAfterHeader > 0 ? Math.min(retryAfterHeader, maxTimeout) : Math.min(currentTimeout * timeoutFactor ** counter, maxTimeout); |
nothing calls this directly
no test coverage detected