Interface DefaultHttpClientOptions

The options available for the DataAPIClient related to making HTTP requests using the default http client.

If loading the default client fails, and httpOptions is set, it'll throw an FailedToLoadDefaultClientError.

If loading the default client fails, and httpOptions is not set, it'll silently fall back to the native fetch API.

If you're minifying your code, you'll need to provide the fetch-h2 module manually (see DefaultHttpClientOptions.fetchH2).

See the astra-db-ts README for more information on different clients.

https://github.com/datastax/astra-db-ts

interface DefaultHttpClientOptions {
    client?: "default";
    fetchH2?: unknown;
    http1?: Http1Options;
    preferHttp2?: boolean;
}

Properties

client?: "default"

Use the default http client for making HTTP requests (currently fetch-h2).

Leave undefined to use the default client (you don't need to specify 'default').

fetchH2?: unknown

The fetch-h2 module to use for making HTTP requests.

Leave undefined to use the default module.

http1?: Http1Options

Options specific to HTTP/1.1 requests.

preferHttp2?: boolean

Whether to prefer HTTP/2 for requests to the Data API; if set to false, HTTP/1.1 will be used instead.

Note that this is only available when using the Data API; the DevOps API does not support HTTP/2

Both versions are generally interchangeable, but HTTP2 is generally recommended for better performance.

Defaults to true if never provided.

Default Value

true