Skip to content

Commit 6a16e20

Browse files
committed
fix: handle undefined return values in parseRetryAfter function
1 parent 5d35490 commit 6a16e20

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/core/src/fetch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export async function createFetch(
114114
maxDelay = FETCH_RETRY_MAX_DELAY_DEFAULT,
115115
maxRetryAfter = FETCH_RETRY_MAX_RETRY_AFTER_DEFAULT,
116116
cancellationToken,
117-
} = options;
117+
} = options || {};
118118
const minDelay = FETCH_RETRY_MIN_DELAY_DEFAULT;
119119

120120
dbg(`create fetch`);

packages/core/test/fetch-retry-after.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ describe("parseRetryAfter", () => {
2222
});
2323

2424
test("handles invalid input", () => {
25-
assert.strictEqual(parseRetryAfter(""), null);
26-
assert.strictEqual(parseRetryAfter("invalid"), null);
27-
assert.strictEqual(parseRetryAfter("not-a-date"), null);
25+
assert.strictEqual(parseRetryAfter(""), undefined);
26+
assert.strictEqual(parseRetryAfter("invalid"), undefined);
27+
assert.strictEqual(parseRetryAfter("not-a-date"), undefined);
2828
});
2929

3030
test("handles negative seconds", () => {
31-
assert.strictEqual(parseRetryAfter("-10"), null);
31+
assert.strictEqual(parseRetryAfter("-10"), undefined);
3232
});
3333

3434
test("handles past dates", () => {

0 commit comments

Comments
 (0)