mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-10-09 09:59:45 +07:00
node_modules: update (#328)
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
1 parent
23dc752083
commit
0e0ab085a3
10 files changed
+460
-192
No files matched your search
+33
-4
@@ -90,6 +90,7 @@ class RetryHandler {
|
||||
this.end = null
|
||||
this.etag = null
|
||||
this.resume = null
|
||||
this.headersSent = false
|
||||
|
||||
// Handle possible onConnect duplication
|
||||
this.handler.onConnect(reason => {
|
||||
@@ -102,6 +103,20 @@ class RetryHandler {
|
||||
})
|
||||
}
|
||||
|
||||
checkpointResponseEnd (headers, resume) {
|
||||
if (this.end == null && this.opts.method !== 'HEAD') {
|
||||
const contentLength = headers['content-length']
|
||||
this.end = contentLength != null ? Number(contentLength) - 1 : null
|
||||
|
||||
assert(
|
||||
this.end == null || Number.isFinite(this.end),
|
||||
'invalid content-length'
|
||||
)
|
||||
}
|
||||
|
||||
this.resume = this.end != null ? resume : null
|
||||
}
|
||||
|
||||
onRequestSent () {
|
||||
if (this.handler.onRequestSent) {
|
||||
this.handler.onRequestSent()
|
||||
@@ -190,7 +205,12 @@ class RetryHandler {
|
||||
this.retryCount += 1
|
||||
|
||||
if (statusCode >= 300) {
|
||||
if (this.retryOpts.statusCodes.includes(statusCode) === false) {
|
||||
// Only expose a response if no earlier attempt has reached the caller.
|
||||
// Otherwise abort this attempt so the error settles the existing body
|
||||
// instead of replacing it with a new response.
|
||||
if (!this.headersSent && this.retryOpts.statusCodes.includes(statusCode) === false) {
|
||||
this.headersSent = true
|
||||
this.checkpointResponseEnd(headers, resume)
|
||||
return this.handler.onHeaders(
|
||||
statusCode,
|
||||
rawHeaders,
|
||||
@@ -259,8 +279,15 @@ class RetryHandler {
|
||||
|
||||
const { start, size, end = size - 1 } = contentRange
|
||||
|
||||
assert(this.start === start, 'content-range mismatch')
|
||||
assert(this.end == null || this.end === end, 'content-range mismatch')
|
||||
if (this.start !== start || (this.end != null && this.end !== end)) {
|
||||
this.abort(
|
||||
new RequestRetryError('Content-Range mismatch', statusCode, {
|
||||
headers,
|
||||
data: { count: this.retryCount }
|
||||
})
|
||||
)
|
||||
return false
|
||||
}
|
||||
|
||||
this.resume = resume
|
||||
return true
|
||||
@@ -272,6 +299,7 @@ class RetryHandler {
|
||||
const range = parseRangeHeader(headers['content-range'])
|
||||
|
||||
if (range == null) {
|
||||
this.headersSent = true
|
||||
return this.handler.onHeaders(
|
||||
statusCode,
|
||||
rawHeaders,
|
||||
@@ -310,6 +338,7 @@ class RetryHandler {
|
||||
)
|
||||
|
||||
this.resume = resume
|
||||
this.headersSent = true
|
||||
this.etag = headers.etag != null ? headers.etag : null
|
||||
|
||||
// Weak etags are not useful for comparison nor cache
|
||||
@@ -349,7 +378,7 @@ class RetryHandler {
|
||||
}
|
||||
|
||||
onError (err) {
|
||||
if (this.aborted || isDisturbed(this.opts.body)) {
|
||||
if (this.aborted || isDisturbed(this.opts.body) || (this.headersSent && this.resume == null)) {
|
||||
return this.handler.onError(err)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user