Taquito TypeDocs
    Preparing search index...

    Class HttpBackend

    HTTP client used by Taquito to communicate with Tezos RPC nodes.

    Uses globalThis.fetch (Node.js >= 22 built-in or browser native). Retries eligible transport failures, such as socket resets and DNS errors, and transient gateway HTTP statuses (502, 503, 504) on allowlisted requests (GET and safe RPC POST endpoints) with exponential backoff and jitter. Requests that fail with HttpTimeoutError are not retried. Configure via environment variables:

    • TAQUITO_HTTP_RETRY_COUNT - max retries (default 1)
    • TAQUITO_HTTP_RETRY_BASE_MS - base delay in ms (default 100)
    • TAQUITO_HTTP_TRACE - emit JSON request logs when true or 1
    Index
    • Send an HTTP request to the given URL, with automatic retries on retriable transport errors and transient gateway statuses (502, 503, 504) for allowlisted requests. The timeout covers headers and body reads for each attempt. Non-abort errors reading a successful response body, including JSON parse errors, propagate unchanged. Failures reading an HTTP error response body retain the status-based retry policy.

      Type Parameters

      • T

      Parameters

      • options: HttpRequestOptions

        Request configuration (URL, method, per-attempt timeout, headers, etc.).

      • Optionaldata: string | object

        Request body, serialized to JSON via JSON.stringify.

      Returns Promise<T>

      The parsed JSON response (or raw text when json: false).

      HttpResponseError when the server returns HTTP status >= 400 (after any applicable retries).

      HttpTimeoutError when an attempt times out before response headers or while reading a successful response body.

      HttpRequestFailed for transport failures before reading a successful body.