diefferson / http_certificate_pinning

Https Certificate pinning for Flutter
Apache License 2.0
83 stars 70 forks source link

error miss caused by splitting whenComplete instead of inline http_certificate_pinning/lib/src/dio/certificate_pinning_interceptor.dart #26

Closed BVCobyAmar closed 10 months ago

BVCobyAmar commented 2 years ago

This issue is easy to fix and can help solve problems with missed errors. The issue is that because of adding the whenComplete function to the secure param instead of chaining it inline. Here is an example of my fix: String resp = '';

secure = HttpCertificatePinning.check(
        serverURL: options.baseUrl,
        headerHttp: options.headers.map((a, b) => MapEntry(a, b.toString())),
        sha: SHA.SHA256,
        allowedSHAFingerprints: _allowedSHAFingerprints,
        timeout: _timeout,
      ).whenComplete(() => secure = null);
diefferson commented 1 year ago

@BVCobyAmar Could you give more details about how can I reproduce this issue?