Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 4.42.1 #426

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "4.42.0"
".": "4.42.1"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
12 changes: 11 additions & 1 deletion src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
);
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '4.42.0'; // x-release-please-version
export const VERSION = '4.42.1'; // x-release-please-version
13 changes: 13 additions & 0 deletions tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Response> => {
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' });
Expand Down
Loading