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

NSErrorFailingURLKey is null #41

Open enyineer opened 5 years ago

enyineer commented 5 years ago

Hello. I just created a new NativeScript test application. When I run "tns run ios --syncAllFiles" and then do a request behind a proxy (which fails because the emulator is not behind that proxy) the plugin throws an error. In https.ios.js on line 64 "error.userInfo.objectForKey('NSErrorFailingURLKey')" evaluates to "null" which crashes the app because "null is not an object (evaluating 'error.userInfo.objectForKey('NSErrorFailingURLKey').description')".

ghost commented 5 years ago

I am getting the same issue. Is this plugin still being working on?

hkurma commented 4 years ago

I'm facing the same issue in one of our applications. Any inputs or workarounds on how this can be resolved?

PolCPP commented 4 years ago

I was just hit by this, and after fighting a bit with it i found the issue in my case.

When passing, "Content-Type": "application/json" and another header (in my case an auth token) make sure the response returns parseable json otherwise you get those crashes. Alternatively put another header like text/html

farfromrefug commented 4 years ago

I will fix this!

PolCPP commented 4 years ago

@farfromrefug , thanks. As long as the responses are ok it should be fine anyway, my guess it's AFJSONResponseSerializer that explodes on invalid responses.

farfromrefug commented 4 years ago

@PolCPP fixed in the repo. @EddyVerbruggen needs to publish it

PolCPP commented 4 years ago

Oh, awesome! Thanks!