nativescript-community / https

Secure HTTP client with SSL pinning for Nativescript - iOS/Android
https://nativescript-community.github.io/https/
Other
50 stars 42 forks source link

iOS error handling oddities #6

Open EddyVerbruggen opened 7 years ago

EddyVerbruggen commented 7 years ago

Hi!

Thanks for your great work on this plugin 👍👍👍

Strange things I noticed (and will send a PR for) when testing error flows on iOS. For instance when an error 500 is returned (tested with https://httpbin.org/status/500).

  1. This plugin swallows the parse exception on both iOS and Android and resolves the promise, but the built-in NativeScript http plugin rejects the promise in case of parse exceptions. I'm not saying one is better than the other, but the difference bit me while trying to use this as a drop-in replacement. Would you accept a PR that rejects the promise like the http module does? I take no for an answer it's your plugin and changing this behavior my be problematic for existing users ;)
  2. When a failure occurs on iOS the plugin assumes it's a pinning failure in case pinning was enabled. In case of a 500 for instance it's simply an error on the server, while the certificate is fine.