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

chore(internal): codegen related update #35

Merged
merged 1 commit into from
Jan 23, 2025
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
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ export interface ClientOptions {
* Note that request timeouts are retried by default, so in a worst-case scenario you may wait
* much longer than this timeout before the promise succeeds or fails.
*/
timeout?: number;
timeout?: number | undefined;

/**
* An HTTP agent used to manage HTTP(S) connections.
*
* If not provided, an agent will be constructed by default in the Node.js environment,
* otherwise no agent is used.
*/
httpAgent?: Agent;
httpAgent?: Agent | undefined;

/**
* Specify a custom `fetch` function implementation.
Expand All @@ -65,23 +65,23 @@ export interface ClientOptions {
*
* @default 2
*/
maxRetries?: number;
maxRetries?: number | undefined;

/**
* Default headers to include with every request to the API.
*
* These can be removed in individual requests by explicitly setting the
* header to `undefined` or `null` in request options.
*/
defaultHeaders?: Core.Headers;
defaultHeaders?: Core.Headers | undefined;

/**
* Default query parameters to include with every request to the API.
*
* These can be removed in individual requests by explicitly setting the
* param to `undefined` in request options.
*/
defaultQuery?: Core.DefaultQuery;
defaultQuery?: Core.DefaultQuery | undefined;
}

/**
Expand Down
9 changes: 9 additions & 0 deletions tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ describe('instantiate client', () => {
expect(response).toEqual({ url: 'http://localhost:5000/foo', custom: true });
});

test('explicit global fetch', async () => {
// make sure the global fetch type is assignable to our Fetch type
const client = new Conductor({
baseURL: 'http://localhost:5000/',
apiKey: 'My API Key',
fetch: defaultFetch,
});
});

test('custom signal', async () => {
const client = new Conductor({
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
Expand Down