0 purchases
dio http adapter
dio_http_adapter #
A customized dio HttpClientAdapter based on the dart:io package, to work around the "Hostname mismatch" issue
when accessing URIs with an IP address (DNS over HTTP for example).
Usage #
Get an IP address of the 'pub.dev' site:
ping pub.dev
PING pub.dev (216.239.38.21) 56(84) bytes of data.
64 bytes from any-in-2615.1e100.net (216.239.38.21): icmp_seq=1 ttl=112 time=88.7 ms
copied to clipboard
Or using a dart package like dns
Access it using dio:
final dio = Dio(BaseOptions(
baseUrl: 'https://216.239.38.21', // uses an IP address
headers: <String, dynamic>{
'host': 'pub.dev', // specifies the host name
},
))..httpClientAdapter = IoHttpClientAdapter(); // uses the customized adapter
final resp = await dio.head('/');
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.