赞
踩
Dio dio = Dio(_options)
(dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
(client) {
client.badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
client.findProxy = (uri) {
if (proxyIP == null || proxyIP.isEmpty) {
return 'DIRECT';
}
return 'PROXY $proxyIP:$proxyPort';
};
return client;
};
项目运行时报了如下错误:
HandshakeException: Handshake error in client (OS Error: CERTIFICATE_VERIFY_FAILED: self signed certificate in certificate chain(handshake.cc:393))
解决方法:
Dio dio = Dio(_options)
(dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
(client) {
client.badCertificateCallback = (cert, host, port) {
return true;
};
};
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。