Skip to content

HTTPRetry

Wraps the HTTP operations (GET, POST, PUT, DELETE, multipart SEND) with retry on network errors.

Used through the shared httpr instance by all CAWS services.

Key points:

  • Retries only on SocketException or TimeoutException; HTTP error responses are returned as-is.
  • Makes up to 15 attempts with exponential backoff (from the retry package), each delay capped at 30 seconds.
  • Each attempt times out after 20 seconds (15 for DELETE, 5 for SEND).

Constructors

HTTPRetry

HTTPRetry()

Properties

client

Client client
final

Methods

delete

Future<Response> delete(
  1. String url, {
  2. Map<String, String>? headers,
})

Sends an HTTP DELETE request with the given headers to the given url.

get

Future<Response> get(
  1. String url, {
  2. Map<String, String>? headers,
})

Sends an HTTP GET request with the given headers to the given url.

post

Future<Response> post(
  1. String url, {
  2. Map<String, String>? headers,
  3. Object? body,
  4. Encoding? encoding,
})

Sends an HTTP POST request with the given headers and body to the given url.

put

Future<Response> put(
  1. String url, {
  2. Map<String, String>? headers,
  3. Object? body,
  4. Encoding? encoding,
})

Sends an HTTP PUT request with the given headers and body to the given url.

send

Sends a multipart request.

On retry the request is rebuilt, cloning any ClonableMultipartFiles. Other file types are dropped from the retried request.