Skip to content

Commit 98fd97d

Browse files
chore(internal): codegen related update (#90)
1 parent 351f322 commit 98fd97d

File tree

2 files changed

+1
-28
lines changed

2 files changed

+1
-28
lines changed

src/core.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -522,19 +522,9 @@ export abstract class APIClient {
522522

523523
const timeout = setTimeout(() => controller.abort(), ms);
524524

525-
const fetchOptions = {
526-
signal: controller.signal as any,
527-
...options,
528-
};
529-
if (fetchOptions.method) {
530-
// Custom methods like 'patch' need to be uppercased
531-
// See https://github.com/nodejs/undici/issues/2294
532-
fetchOptions.method = fetchOptions.method.toUpperCase();
533-
}
534-
535525
return (
536526
// use undefined this binding; fetch errors if bound to something else in browser/cloudflare
537-
this.fetch.call(undefined, url, fetchOptions).finally(() => {
527+
this.fetch.call(undefined, url, { signal: controller.signal as any, ...options }).finally(() => {
538528
clearTimeout(timeout);
539529
})
540530
);

tests/index.test.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -122,23 +122,6 @@ describe('instantiate client', () => {
122122
expect(spy).toHaveBeenCalledTimes(1);
123123
});
124124

125-
test('normalized method', async () => {
126-
let capturedRequest: RequestInit | undefined;
127-
const testFetch = async (url: RequestInfo, init: RequestInit = {}): Promise<Response> => {
128-
capturedRequest = init;
129-
return new Response(JSON.stringify({}), { headers: { 'Content-Type': 'application/json' } });
130-
};
131-
132-
const client = new Browserbase({
133-
baseURL: 'http://localhost:5000/',
134-
apiKey: 'My API Key',
135-
fetch: testFetch,
136-
});
137-
138-
await client.patch('/foo');
139-
expect(capturedRequest?.method).toEqual('PATCH');
140-
});
141-
142125
describe('baseUrl', () => {
143126
test('trailing slash', () => {
144127
const client = new Browserbase({ baseURL: 'http://localhost:5000/custom/path/', apiKey: 'My API Key' });

0 commit comments

Comments
 (0)