dio_http_adapter 0.1.0+2 copy "dio_http_adapter: ^0.1.0+2" to clipboard
dio_http_adapter: ^0.1.0+2 copied to clipboard

A customized dio HttpClientAdapter, to workaround the Host verification issue during SSL handshake.

example/main.dart

import 'dart:io';

import 'package:dio/dio.dart';
import 'package:dio_http_adapter/dio_http_adapter.dart';

void main(List<String> args) async {
  if (args == null || args.length < 2) {
    print('Usage: dart main.dart <URI> <HOST>');
    exit(1);
  }

  final uriArg = args[0];

  if (!uriArg.startsWith('https://')) {
    print('URI must start with https://');
    exit(1);
  }

  final uri = Uri.parse(uriArg);
  final host = args[1];

  final dio = Dio()..httpClientAdapter = IoHttpClientAdapter();

  final resp = await dio.headUri(uri,
      options: Options(
        headers: <String, dynamic>{
          // kHostHeaderName: host,
        },
      ));
  resp.headers.forEach((name, values) => print('$name: $values'));
}
1
likes
40
pub points
35%
popularity

Publisher

verified publisherxinthink.com

A customized dio HttpClientAdapter, to workaround the Host verification issue during SSL handshake.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

Dependencies

dio, io_http, meta

More

Packages that depend on dio_http_adapter