Tells the Data API client to use the fetch-h2
module for making HTTP requests.
See HttpOptions for the other options available.
The fetch-h2 module to use for making HTTP requests.
Must be provided, or an error will be thrown.
Optional
http1Options specific to HTTP/1.1 requests.
Optional
preferWhether 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 for using the Data API; the DevOps API does not support HTTP/2.
Both versions are generally interchangeable, but HTTP/2 is recommended for better performance.
Defaults to true
if never provided.
true
Overview
The options available for the DataAPIClient related to making HTTP requests using the
fetch-h2
http client.This, however, requires the
fetch-h2
module to be installed & provided by the user, for compatibility reasons, as it is not available in all environments.Setup
Luckily, it is only a couple of easy steps to get it working:
First, install the
fetch-h2
module:Then, you can provide it to the client like so:
See the astra-db-ts v2.0+ README for more information on how to use
fetch-h2
, and the compatibility reasons for not including it by default.Examples
For a complete example & more information, see the
examples/using-http2
directory in the astra-db-ts repositorySee
HttpOptions