Skip to content

Commit 1131594

Browse files
JhaSourav07ShreyasPatil3105
andauthored
refactor(github): add type annotation to fetchWithRetry return type (JhaSourav07#593)
Co-authored-by: ShreyasPatil3105 <ShreyasPatil3105-shreyasp310505@gmail.com>
2 parents e7ac5e3 + df7a6d8 commit 1131594

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/github.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ const REST_TIMEOUT_MS = 5000; // 5s for REST endpoints
2121

2222
// Retry delay uses exponential backoff: delay = BASE_DELAY_MS * 2^attempt.
2323
export async function fetchWithRetry(
24-
url: string,
24+
url: string | URL,
2525
options: RequestInit,
2626
attempt = 0,
2727
timeoutMs?: number
2828
): Promise<Response> {
2929
// Determine default timeout based on endpoint type if not explicitly provided.
3030
// GraphQL calls carry a larger payload and need a slightly longer window.
3131
const resolvedTimeout =
32-
timeoutMs ?? (url.includes('graphql') ? GRAPHQL_TIMEOUT_MS : REST_TIMEOUT_MS);
32+
timeoutMs ?? (url.toString().includes('graphql') ? GRAPHQL_TIMEOUT_MS : REST_TIMEOUT_MS);
3333

3434
if (options.signal?.aborted) {
3535
throw new Error('AbortError');

0 commit comments

Comments
 (0)