Interface HttpClientFactoryConfig

Factory for creating HTTP clients with automatic injection of:

  • serializer (EJSON-compatible)
  • error registry (from Store)
  • async contexts (from Store)

Note: Node streaming clients are exposed via the Node entry only (see createHttpSmartClient/createHttpMixedClient in @bluelibs/runner/node). Keeping this universal factory browser-safe avoids dynamic imports.

interface HttpClientFactoryConfig {
    auth?: HttpClientAuth;
    baseUrl: string;
    fetchImpl?: {
        (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
        (input: string | URL | Request, init?: RequestInit): Promise<Response>;
    };
    onRequest?: ((ctx: {
        headers: Record<string, string>;
        url: string;
    }) => void | Promise<void>);
    timeoutMs?: number;
}

Properties

baseUrl: string
fetchImpl?: {
    (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
    (input: string | URL | Request, init?: RequestInit): Promise<Response>;
}

Type declaration

    • (input, init?): Promise<Response>
    • Parameters

      • input: URL | RequestInfo
      • Optionalinit: RequestInit

      Returns Promise<Response>

    • (input, init?): Promise<Response>
    • Parameters

      • input: string | URL | Request
      • Optionalinit: RequestInit

      Returns Promise<Response>

onRequest?: ((ctx: {
    headers: Record<string, string>;
    url: string;
}) => void | Promise<void>)
timeoutMs?: number