Skip to main content
Version: Next

FetchHttpClientOptions

Configuration of FetchHttpClient.

Hierarchy

Index

Properties

optionalinheritedcompression

Compression of request bodies: the name of a built-in algorithm, or an HttpCompressor for a custom quality or algorithm.

optionalfetch

fetch?: { (input, init): Promise<Response>; (input, init): Promise<Response> } = { (input, init): Promise<Response>; (input, init): Promise<Response> }

The fetch implementation the requests go through. Pass a wrapper around the global fetch to adjust every request, or the fetch of another library, such as undici with a dispatcher of your own, to control the connections. A stream body reaches it as an async iterable of byte chunks, or as the stream itself in Bun. In a browser or an edge runtime, a web ReadableStream body reaches it as a web stream.


Type declaration

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

    • Parameters

      • input: URL | RequestInfo
      • optionalinit: RequestInit

      Returns Promise<Response>

    • Parameters

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

      Returns Promise<Response>

optionalinheritedheaders

headers?: Record<string, string>

Additional headers sent with every request. They win over the built-in defaults.

optionalinheritedlogger

logger?: Log

Logger for the retry warnings. Defaults to a child of the @apify/log default with an ApifyClient prefix.

optionalinheritedmaxRetries

maxRetries?: number = 8

How many times a failed request is retried at most.

optionalinheritedminDelayBetweenRetriesMillis

minDelayBetweenRetriesMillis?: number = 500

Lower bound for the delay before the first retry in milliseconds. It doubles with every further retry.

optionalinheritedstats

stats?: Statistics

Statistics the client records its calls into. Created when omitted.

optionalinheritedtimeoutLongSecs

timeoutLongSecs?: number = 360

Duration of the long timeout tier, in seconds.

optionalinheritedtimeoutMaxSecs

timeoutMaxSecs?: number = 360

Upper bound for the timeout of a single attempt, in seconds.

optionalinheritedtimeoutMediumSecs

timeoutMediumSecs?: number = 30

Duration of the medium timeout tier, in seconds.

optionalinheritedtimeoutShortSecs

timeoutShortSecs?: number = 5

Duration of the short timeout tier, in seconds.

optionalinheritedtoken

token?: string

Apify API token, sent as a Bearer token in the Authorization header.

optionalinheritedworkflowKey

workflowKey?: string

Value of the X-Apify-Workflow-Key header. Defaults to the APIFY_WORKFLOW_KEY environment variable.