Interface: CreateClientOptions
Defined in: src/client.ts:49
Options for createClient.
Example
ts
import { createClient } from 'sorbus';
import { contract } from './contract';
const api = createClient(contract, '/api/v1', {
headers: () => ({
Authorization: `Bearer ${getToken()}`,
}),
serializeKey: 'snake',
normalizeKey: 'camel',
});Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
cache? | Cache | The ETag cache for GET requests. | src/client.ts:51 |
fetch? | (input, init?) => Promise<Response> | The fetch implementation. Defaults to globalThis.fetch. | src/client.ts:53 |
headers? | HeadersInit | () => HeadersInit | The headers for every request. | src/client.ts:55 |
normalizeKey? | KeyFormat | (key) => string | The key transform for response data. | src/client.ts:57 |
serializeKey? | KeyFormat | (key) => string | The key transform for request data. | src/client.ts:59 |