Jonny Borges
Committed by GitHub

Merge pull request #1973 from jtans/master

GetConnect support proxy setting
... ... @@ -115,6 +115,7 @@ class GetConnect extends GetConnectInterface {
Decoder? defaultDecoder;
Duration timeout;
List<TrustedCertificate>? trustedCertificates;
String Function(Uri url)? findProxy;
GetHttpClient? _httpClient;
List<GetSocket>? _sockets;
bool withCredentials;
... ... @@ -134,6 +135,7 @@ class GetConnect extends GetConnectInterface {
baseUrl: baseUrl,
trustedCertificates: trustedCertificates,
withCredentials: withCredentials,
findProxy: findProxy
);
@override
... ...
... ... @@ -39,6 +39,8 @@ class GetHttpClient {
final GetModifier _modifier;
String Function(Uri url)? findProxy;
GetHttpClient({
this.userAgent = 'getx-client',
this.timeout = const Duration(seconds: 8),
... ... @@ -50,10 +52,12 @@ class GetHttpClient {
this.baseUrl,
List<TrustedCertificate>? trustedCertificates,
bool withCredentials = false,
String Function(Uri url)? findProxy,
}) : _httpClient = HttpRequestImpl(
allowAutoSignedCert: allowAutoSignedCert,
trustedCertificates: trustedCertificates,
withCredentials: withCredentials,
findProxy: findProxy,
),
_modifier = GetModifier();
... ...
... ... @@ -17,6 +17,7 @@ class HttpRequestImpl extends HttpRequestBase {
bool allowAutoSignedCert = true,
List<TrustedCertificate>? trustedCertificates,
bool withCredentials = false,
String Function(Uri url)? findProxy,
}) {
_httpClient = io.HttpClient();
if (trustedCertificates != null) {
... ... @@ -29,6 +30,7 @@ class HttpRequestImpl extends HttpRequestBase {
_httpClient = io.HttpClient(context: _securityContext);
_httpClient!.badCertificateCallback = (_, __, ___) => allowAutoSignedCert;
_httpClient!.findProxy = findProxy;
}
@override
... ...
... ... @@ -8,6 +8,7 @@ class HttpRequestImpl extends HttpRequestBase {
bool allowAutoSignedCert = true,
List<TrustedCertificate>? trustedCertificates,
bool withCredentials = false,
String Function(Uri url)? findProxy,
});
@override
void close() {}
... ...