HttpRequestImpl constructor

HttpRequestImpl({
  1. bool allowAutoSignedCert = true,
  2. List<TrustedCertificate>? trustedCertificates,
  3. bool withCredentials = false,
  4. String findProxy(
    1. Uri url
    )?,
})

Implementation

HttpRequestImpl({
  bool allowAutoSignedCert = true,
  List<TrustedCertificate>? trustedCertificates,
  bool withCredentials = false,
  String Function(Uri url)? findProxy,
}) {
  _httpClient = io.HttpClient();
  if (trustedCertificates != null) {
    _securityContext = io.SecurityContext();
    for (final trustedCertificate in trustedCertificates) {
      _securityContext!
          .setTrustedCertificatesBytes(List.from(trustedCertificate.bytes));
    }
  }

  _httpClient = io.HttpClient(context: _securityContext);
  _httpClient!.badCertificateCallback = (_, __, ___) => allowAutoSignedCert;
  _httpClient!.findProxy = findProxy;
}