defaultHtmlFetcher function
The default dart:io HtmlFetcher used when none is injected.
Fails loudly instead of auditing garbage: throws TimeoutException when
the server does not answer within timeout and HttpException on a
non-2xx status (a 404 page with pretty meta tags must not pass an audit).
Implementation
HtmlFetcher defaultHtmlFetcher({
Duration timeout = const Duration(seconds: 30),
}) {
return (Uri uri, {Map<String, String> headers = const {}}) {
return _httpFetch(uri, headers: headers).timeout(timeout);
};
}