HttpFetcher constructor

HttpFetcher({
  1. required String userAgent,
  2. HttpClient client()?,
  3. Duration timeout = const Duration(seconds: 60),
})

A fetcher announcing itself as userAgent, making connections with client (tests pass a fake), and giving up on a server that stays silent for timeout.

Implementation

HttpFetcher({
  required this.userAgent,
  HttpClient Function()? client,
  this.timeout = const Duration(seconds: 60),
}) : _client = client ?? HttpClient.new;