Skip to content

Commit

Permalink
chore(internal): remove unnecessary getRequestClient function (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Dec 10, 2024
1 parent 786da57 commit bc28efe
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 @@ -523,19 +523,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 bc28efe

Please sign in to comment.