FetchHttpClientOptions
Interface | Source Code
Properties
Section titled “Properties”defaultRequestOptions?: Omit<RequestInit, “method”>
Section titled “defaultRequestOptions?: Omit<RequestInit, “method”>”host?: string
Section titled “host?: string”The host that will always used for this client. The host is the domain + TLD.
Defaults to an empty string (i.e., no default host).
Example
Section titled “Example”host: 'api.somecoolsite.com'path?: string
Section titled “path?: string”The path that will be appended to all requests this client makes.
Should begin with a /.
Defaults to an empty string (i.e., no base path).
Example
Section titled “Example”path: '/base/path/for/calls'protocol?: HttpProtocol
Section titled “protocol?: HttpProtocol”The HTTP protocol that the client uses.
Defaults to HTTP.
rateLimitMs?: number
Section titled “rateLimitMs?: number”The minimum amount of time that must pass between requests this client makes. This can be useful for limiting this client in accordance with an API’s restrictions.
If a request is made before this time has elapsed, the client will wait to make the request. The client may wait longer than this value, but will not wait any less than this value.
Values less than 10 will not be accurate. When limited, the client
won’t make requests any faster than at least 10ms apart. If you need
less than 10ms between calls, it’s unlikely you need a rate limit.
If multiple requests are initiated during the waiting period, they will be queued and executed in the order they were received.
Use this only when required. A call may have to wait a significant amount of time if you have a long wait time and are frequently making requests.
Defaults to no limit.