HttpFetcher.simple constructor

HttpFetcher.simple({
  1. List<Uri>? endpoints,
  2. HttpValidator validator = _validate200OK,
})

A HTTP fetcher using optional endpoints.

For each request on a server the proxy creates a new http.Client instance (of the http package).

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.simple({
  List<Uri>? endpoints,
  HttpValidator validator = _validate200OK,
}) =>
    HttpFetcher._(
      HttpAdapter.simple(),
      null,
      _endpointResolver(endpoints),
      validator,
    );