Skip to content
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ await workos.get('/organizations', { maxRetries: 0 });

Set `maxRetries: 0` to disable automatic retries entirely.

The request timeout (`timeout`, 60 seconds by default) covers each attempt from
the request being sent to the response body being fully read, so a server that
returns headers promptly but stalls the body still times out. A timeout while
reading a successful response body is reported as a 408 but is not
automatically retried, because the server has already applied the request.

### Access token issuer validation

Session helpers (`authenticateWithSessionCookie`, `loadSealedSession(...).authenticate()`)
Expand Down
9 changes: 8 additions & 1 deletion setup-jest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { enableFetchMocks } from 'jest-fetch-mock';
import { webcrypto } from 'crypto';

// jest-fetch-mock replaces the global fetch the moment it is loaded. Keep the
// runtime's own implementation reachable for tests that need real HTTP
// streaming and abort behaviour (see fetch-client.spec.ts).
const NATIVE_FETCH_KEY = '__workosNativeFetch';
(globalThis as Record<string, unknown>)[NATIVE_FETCH_KEY] = globalThis.fetch;

const { enableFetchMocks } = require('jest-fetch-mock');

enableFetchMocks();

// Make Node's crypto.webcrypto available as global.crypto for tests
Expand Down
Loading
Loading