Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/aws4fetch.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class AwsClient {
return fetched
}
const res = await fetched;
if (res.status < 500 && res.status !== 429) {
if (res.status < 500 && res.status !== 429 && res.status !== 408) {
return res
}
await new Promise(resolve => setTimeout(resolve, Math.random() * this.initRetryMs * Math.pow(2, i)));
Expand Down
2 changes: 1 addition & 1 deletion dist/aws4fetch.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class AwsClient {
return fetched
}
const res = await fetched;
if (res.status < 500 && res.status !== 429) {
if (res.status < 500 && res.status !== 429 && res.status !== 408) {
return res
}
await new Promise(resolve => setTimeout(resolve, Math.random() * this.initRetryMs * Math.pow(2, i)));
Expand Down
2 changes: 1 addition & 1 deletion dist/aws4fetch.esm.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class AwsClient {
return fetched
}
const res = await fetched;
if (res.status < 500 && res.status !== 429) {
if (res.status < 500 && res.status !== 429 && res.status !== 408) {
return res
}
await new Promise(resolve => setTimeout(resolve, Math.random() * this.initRetryMs * Math.pow(2, i)));
Expand Down
2 changes: 1 addition & 1 deletion dist/aws4fetch.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
return fetched
}
const res = await fetched;
if (res.status < 500 && res.status !== 429) {
if (res.status < 500 && res.status !== 429 && res.status !== 408) {
return res
}
await new Promise(resolve => setTimeout(resolve, Math.random() * this.initRetryMs * Math.pow(2, i)));
Expand Down
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class AwsClient {
return fetched // No need to await if we're returning anyway
}
const res = await fetched
if (res.status < 500 && res.status !== 429) {
if (res.status < 500 && res.status !== 429 && res.status !== 408) {
return res
}
await new Promise(resolve => setTimeout(resolve, Math.random() * this.initRetryMs * Math.pow(2, i)))
Expand Down
12 changes: 12 additions & 0 deletions test/paramTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ export default async() => {
})).headers.get('authorization')
assertEqual(authorization, 'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/sqs/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=28cde03d679fcd9082587d2705ea318df3d61f4d5d7006668b039b66f06c750c')
}

const originalFetch = globalThis.fetch
let attempts = 0
globalThis.fetch = async() => new Response(null, { status: ++attempts === 1 ? 408 : 200 })

try {
const response = await new AwsClient({ ...keys, retries: 1, initRetryMs: 1 }).fetch(url)
assertEqual(response.status, 200)
assertEqual(attempts, 2)
} finally {
globalThis.fetch = originalFetch
}
}

function assertEqual(actual, expected) {
Expand Down