From 92d4a1ffcc50eff03215afa1d5f0f00d6127f2c4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 22:04:57 +0000 Subject: [PATCH 1/3] fix(client): normalize method (#425) --- src/core.ts | 12 +++++++++++- tests/index.test.ts | 13 +++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/core.ts b/src/core.ts index 0150792..c0d70da 100644 --- a/src/core.ts +++ b/src/core.ts @@ -522,9 +522,19 @@ export abstract class APIClient { const timeout = setTimeout(() => controller.abort(), ms); + const fetchOptions = { + signal: controller.signal as any, + ...options, + }; + if (fetchOptions.method) { + // Custom methods like 'patch' need to be uppercased + // See https://github.com/nodejs/undici/issues/2294 + fetchOptions.method = fetchOptions.method.toUpperCase(); + } + return ( // 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(() => { + this.fetch.call(undefined, url, fetchOptions).finally(() => { clearTimeout(timeout); }) ); diff --git a/tests/index.test.ts b/tests/index.test.ts index e8fb5d0..4c4b1ef 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -122,6 +122,19 @@ describe('instantiate client', () => { expect(spy).toHaveBeenCalledTimes(1); }); + test('normalized method', async () => { + let capturedRequest: RequestInit | undefined; + const testFetch = async (url: RequestInfo, init: RequestInit = {}): Promise => { + capturedRequest = init; + return new Response(JSON.stringify({}), { headers: { 'Content-Type': 'application/json' } }); + }; + + const client = new Orb({ baseURL: 'http://localhost:5000/', apiKey: 'My API Key', fetch: testFetch }); + + await client.patch('/foo'); + expect(capturedRequest?.method).toEqual('PATCH'); + }); + describe('baseUrl', () => { test('trailing slash', () => { const client = new Orb({ baseURL: 'http://localhost:5000/custom/path/', apiKey: 'My API Key' }); From 6d484537b4105c7d6c876931f3c30c760bc956b8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 01:17:45 +0000 Subject: [PATCH 2/3] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index fcff3ba..3147fc5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-02151f7654870aee7820ee1c04659a469e6b67ac4977116334512c6b6e6a2016.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-d0a97f690d07742fea0d6c9b9b0d9dae5e8490eb03a7f3da27989fdf53d3e45d.yml From 128068e727835736a8649b6ae7de95671e2f3952 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 01:18:07 +0000 Subject: [PATCH 3/3] release: 4.42.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ package.json | 2 +- src/version.ts | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index bca107b..487d8f7 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.42.0" + ".": "4.42.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 54c7b1a..c4be147 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.42.1 (2024-12-20) + +Full Changelog: [v4.42.0...v4.42.1](https://github.com/orbcorp/orb-node/compare/v4.42.0...v4.42.1) + +### Bug Fixes + +* **client:** normalize method ([#425](https://github.com/orbcorp/orb-node/issues/425)) ([92d4a1f](https://github.com/orbcorp/orb-node/commit/92d4a1ffcc50eff03215afa1d5f0f00d6127f2c4)) + ## 4.42.0 (2024-12-17) Full Changelog: [v4.41.0...v4.42.0](https://github.com/orbcorp/orb-node/compare/v4.41.0...v4.42.0) diff --git a/package.json b/package.json index b929ac5..7457aa0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orb-billing", - "version": "4.42.0", + "version": "4.42.1", "description": "The official TypeScript library for the Orb API", "author": "Orb ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index c1a790c..ef6c00a 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.42.0'; // x-release-please-version +export const VERSION = '4.42.1'; // x-release-please-version