Skip to content

Commit 668a9d1

Browse files
chore(internal): codegen related update (#99)
1 parent 1533ff8 commit 668a9d1

File tree

3 files changed

+5
-32
lines changed

3 files changed

+5
-32
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Setting up the environment
22

3-
This repository uses [`yarn@v1`](https://classic.yarnpkg.com/lang/en/docs/install).
3+
This repository uses [`yarn@v1`](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable).
44
Other package managers may work but are not officially supported for development.
55

66
To set up the repository, run:
@@ -29,10 +29,10 @@ All files in the `examples/` directory are not modified by the generator and can
2929
3030
```
3131

32-
```sh
33-
$ chmod +x examples/<your-example>.ts
32+
```
33+
chmod +x examples/<your-example>.ts
3434
# run the example against your api
35-
$ yarn tsn -T examples/<your-example>.ts
35+
yarn tsn -T examples/<your-example>.ts
3636
```
3737

3838
## Using the repository from source

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)