我正在尝试创建一个访问第三方 API 的代理服务器,但他们的开发端点有证书错误。使用 http.dart 时是否有绕过 ssl 错误的方法?
import 'package:http/http.dart' as http;
Uri url = Uri.parse("https://url-with-ssl-error.com/endpoint");
http.get(url).then((response) => print(response.body));
这是返回的错误:
Uncaught Error: SocketIOException: RawSecureSocket error (Unexpected handshake error in client) (OS Error: errno = -8172)
Unhandled exception:
SocketIOException: RawSecureSocket error (Unexpected handshake error in client) (OS Error: errno = -8172)
#0 _FutureImpl._scheduleUnhandledError.<anonymous closure> (dart:async/future_impl.dart:207:9)
#1 Timer.run.<anonymous closure> (dart:async/timer.dart:17:21)
#2 Timer.run.<anonymous closure> (dart:async/timer.dart:25:13)
#3 Timer.Timer.<anonymous closure> (dart:async-patch:15:15)
#4 _Timer._createTimerHandler._handleTimeout (dart:io:6990:28)
#5 _Timer._createTimerHandler._handleTimeout (dart:io:6998:7)
#6 _Timer._createTimerHandler.<anonymous closure> (dart:io:7006:23)
#7 _ReceivePortImpl._handleMessage (dart:isolate-patch:81:92)