diff --git a/lib/http_client_with_interceptor.dart b/lib/http_client_with_interceptor.dart index b349fa0..014d644 100644 --- a/lib/http_client_with_interceptor.dart +++ b/lib/http_client_with_interceptor.dart @@ -41,13 +41,15 @@ class HttpClientWithInterceptor extends BaseClient { Duration requestTimeout; RetryPolicy retryPolicy; bool Function(X509Certificate, String, int) badCertificateCallback; + String Function(Uri) findProxy; int _retryCount = 0; Client _client; void _initializeClient() { var ioClient = new HttpClient() - ..badCertificateCallback = badCertificateCallback; + ..badCertificateCallback = badCertificateCallback + ..findProxy = findProxy; _client = IOClient(ioClient); } @@ -56,6 +58,7 @@ class HttpClientWithInterceptor extends BaseClient { this.requestTimeout, this.retryPolicy, this.badCertificateCallback, + this.findProxy, }); factory HttpClientWithInterceptor.build({ @@ -63,6 +66,7 @@ class HttpClientWithInterceptor extends BaseClient { Duration requestTimeout, RetryPolicy retryPolicy, bool Function(X509Certificate, String, int) badCertificateCallback, + String Function(Uri) findProxy, }) { assert(interceptors != null); @@ -72,7 +76,8 @@ class HttpClientWithInterceptor extends BaseClient { interceptors: interceptors, requestTimeout: requestTimeout, retryPolicy: retryPolicy, - badCertificateCallback: badCertificateCallback); + badCertificateCallback: badCertificateCallback, + findProxy: findProxy); } Future head(url, {Map headers}) => _sendUnstreamed( diff --git a/lib/models/request_data.dart b/lib/models/request_data.dart index 6440952..6ae886e 100644 --- a/lib/models/request_data.dart +++ b/lib/models/request_data.dart @@ -1,5 +1,4 @@ import 'dart:convert'; -import 'package:flutter/foundation.dart'; import 'package:http/http.dart'; import 'package:http_interceptor/http_methods.dart'; @@ -14,8 +13,8 @@ class RequestData { Encoding encoding; RequestData({ - @required this.method, - @required this.baseUrl, + this.method, + this.baseUrl, this.headers, this.params, this.body,