HttpFetcher.custom constructor

HttpFetcher.custom({
  1. required HttpAdapter adapter,
  2. required UriResolver resolver,
  3. HttpValidator validator = _validate200OK,
})

A customized HTTP fetcher using the given adapter and resolver.

A custom HttpAdapter can be used to customize HTTP requests and a custom UriResolver to customize resolving from URI references to absolute URIs.

An optional validator function handles how a HTTP response is converted to a HttpContent instance or thrown as HttpException. If not set, then only HTTP 200 OK responses are validated successful and returned as content.

Implementation

factory HttpFetcher.custom({
  required HttpAdapter adapter,
  required UriResolver resolver,
  HttpValidator validator = _validate200OK,
}) =>
    HttpFetcher._(
      adapter,
      null,
      resolver,
      validator,
    );