Jonny Borges
Committed by GitHub

Merge pull request #1451 from jasonlaw/master

Make withCredentials configurable
@@ -97,6 +97,7 @@ class GetConnect extends GetConnectInterface { @@ -97,6 +97,7 @@ class GetConnect extends GetConnectInterface {
97 this.maxRedirects = 5, 97 this.maxRedirects = 5,
98 this.maxAuthRetries = 1, 98 this.maxAuthRetries = 1,
99 this.allowAutoSignedCert = false, 99 this.allowAutoSignedCert = false,
  100 + this.withCredentials = false,
100 }) { 101 }) {
101 $configureLifeCycle(); 102 $configureLifeCycle();
102 } 103 }
@@ -113,6 +114,7 @@ class GetConnect extends GetConnectInterface { @@ -113,6 +114,7 @@ class GetConnect extends GetConnectInterface {
113 List<TrustedCertificate>? trustedCertificates; 114 List<TrustedCertificate>? trustedCertificates;
114 GetHttpClient? _httpClient; 115 GetHttpClient? _httpClient;
115 List<GetSocket>? _sockets; 116 List<GetSocket>? _sockets;
  117 + bool withCredentials;
116 118
117 @override 119 @override
118 List<GetSocket> get sockets => _sockets ??= <GetSocket>[]; 120 List<GetSocket> get sockets => _sockets ??= <GetSocket>[];
@@ -127,6 +129,7 @@ class GetConnect extends GetConnectInterface { @@ -127,6 +129,7 @@ class GetConnect extends GetConnectInterface {
127 allowAutoSignedCert: allowAutoSignedCert, 129 allowAutoSignedCert: allowAutoSignedCert,
128 baseUrl: baseUrl, 130 baseUrl: baseUrl,
129 trustedCertificates: trustedCertificates, 131 trustedCertificates: trustedCertificates,
  132 + withCredentials: withCredentials,
130 ); 133 );
131 134
132 @override 135 @override
@@ -46,9 +46,11 @@ class GetHttpClient { @@ -46,9 +46,11 @@ class GetHttpClient {
46 bool allowAutoSignedCert = false, 46 bool allowAutoSignedCert = false,
47 this.baseUrl, 47 this.baseUrl,
48 List<TrustedCertificate>? trustedCertificates, 48 List<TrustedCertificate>? trustedCertificates,
  49 + bool withCredentials = false,
49 }) : _httpClient = HttpRequestImpl( 50 }) : _httpClient = HttpRequestImpl(
50 allowAutoSignedCert: allowAutoSignedCert, 51 allowAutoSignedCert: allowAutoSignedCert,
51 trustedCertificates: trustedCertificates, 52 trustedCertificates: trustedCertificates,
  53 + withCredentials: withCredentials,
52 ), 54 ),
53 _modifier = GetModifier(); 55 _modifier = GetModifier();
54 56
@@ -13,6 +13,7 @@ class HttpRequestImpl implements HttpRequestBase { @@ -13,6 +13,7 @@ class HttpRequestImpl implements HttpRequestBase {
13 HttpRequestImpl({ 13 HttpRequestImpl({
14 bool allowAutoSignedCert = true, 14 bool allowAutoSignedCert = true,
15 List<TrustedCertificate>? trustedCertificates, 15 List<TrustedCertificate>? trustedCertificates,
  16 + this.withCredentials = false,
16 }); 17 });
17 18
18 /// The currently active XHRs. 19 /// The currently active XHRs.
@@ -20,7 +21,7 @@ class HttpRequestImpl implements HttpRequestBase { @@ -20,7 +21,7 @@ class HttpRequestImpl implements HttpRequestBase {
20 21
21 ///This option requires that you submit credentials for requests 22 ///This option requires that you submit credentials for requests
22 ///on different sites. The default is false 23 ///on different sites. The default is false
23 - bool withCredentials = false; 24 + final bool withCredentials;
24 25
25 /// Sends an HTTP request and asynchronously returns the response. 26 /// Sends an HTTP request and asynchronously returns the response.
26 @override 27 @override
@@ -16,6 +16,7 @@ class HttpRequestImpl extends HttpRequestBase { @@ -16,6 +16,7 @@ class HttpRequestImpl extends HttpRequestBase {
16 HttpRequestImpl({ 16 HttpRequestImpl({
17 bool allowAutoSignedCert = true, 17 bool allowAutoSignedCert = true,
18 List<TrustedCertificate>? trustedCertificates, 18 List<TrustedCertificate>? trustedCertificates,
  19 + bool withCredentials = false,
19 }) { 20 }) {
20 _httpClient = io.HttpClient(); 21 _httpClient = io.HttpClient();
21 if (trustedCertificates != null) { 22 if (trustedCertificates != null) {
@@ -7,6 +7,7 @@ class HttpRequestImpl extends HttpRequestBase { @@ -7,6 +7,7 @@ class HttpRequestImpl extends HttpRequestBase {
7 HttpRequestImpl({ 7 HttpRequestImpl({
8 bool allowAutoSignedCert = true, 8 bool allowAutoSignedCert = true,
9 List<TrustedCertificate>? trustedCertificates, 9 List<TrustedCertificate>? trustedCertificates,
  10 + bool withCredentials = false,
10 }); 11 });
11 @override 12 @override
12 void close() {} 13 void close() {}