Function HttpRetry

  • Sets up a retry mechanism for a function which returns an HttpResponse. This retry mechanism uses the standard 429 response code and the "Retry-After" header (by default) to determine when to retry the request.

    Parameters

    • httpRequest: HttpCallback

      A function which returns an HttpResponse. This function will be called each time the request is tried.

    • Optional config: HttpRetryConfig

      An optional configuration object, see HttpRetryConfig for more details. If only providing the retryKey you can provide a string as the retryKey in place of the config object.

    Returns Promise<HttpResponse>

    A promise which when resolved will contain the response from the request. The promise will be rejected if the request fails.

  • Sets up a retry mechanism for a function which returns an HttpResponse. This retry mechanism uses the standard 429 response code and the "Retry-After" header (by default) to determine when to retry the request.

    Parameters

    • httpRequest: HttpCallback

      A function which returns an HttpResponse. This function will be called each time the request is tried.

    • retryKey: string

    Returns Promise<HttpResponse>

    A promise which when resolved will contain the response from the request. The promise will be rejected if the request fails.