Skip to content

Commit

Permalink
chore(internal): remove unnecessary getRequestClient function (#528)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Dec 9, 2024
1 parent 10ae8eb commit a8a00ef
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,19 +509,13 @@ export abstract class APIClient {
const timeout = setTimeout(() => controller.abort(), ms);

return (
this.getRequestClient()
// use undefined this binding; fetch errors if bound to something else in browser/cloudflare
.fetch.call(undefined, url, { signal: controller.signal as any, ...options })
.finally(() => {
clearTimeout(timeout);
})
// use undefined this binding; fetch errors if bound to something else in browser/cloudflare
this.fetch.call(undefined, url, { signal: controller.signal as any, ...options }).finally(() => {
clearTimeout(timeout);
})
);
}

protected getRequestClient(): RequestClient {
return { fetch: this.fetch };
}

private shouldRetry(response: Response): boolean {
// Note this is not a standard header.
const shouldRetryHeader = response.headers.get('x-should-retry');
Expand Down

0 comments on commit a8a00ef

Please sign in to comment.