Skip to content

httpClient

HttpClient

Thin wrapper around axios that centralizes:

  • Host resolution via getHost(name).
  • The backend { successfully: true } contract.
  • Centralized error logging.

Success contract:

  • { successfully: true, ... } → resolves with response.data typed as ApiSuccess<TResponse>.
  • { successfully: !true, ... } with a type in the body → throws ProblemDetailsError.
  • { successfully: !true, ... } without a type → throws ApiError.
  • Thrown axios/network error → logged and re-thrown.
  • Binary responses (responseType: 'blob' | 'arraybuffer') bypass the successfully check and return raw data.

Kind: global class

httpClient.blob()

Low-level download. Returns the raw axios data (typically a Blob).

Kind: instance method of HttpClient