-
Notifications
You must be signed in to change notification settings - Fork 116
Description
Thank you for this plugin, it really saved the day with regards to cordova + ios + xhr + cookies!
I wanted to point out an issue I had with the plugin though. For example, I am making a POST to a URL like this:
https://example.com/?q=api/foo.json&api-key=abc123!_^-etc
With NativeXHRLogging set to full, this error was being thrown to the Console:
NativeXHR: Invalid url scheme 'null'
After some Googling, it seems that NSURL may need some encoding.
To get around this, I added a one line patch to performNativeXHR() in CDVWKWebViewFileXhr.m:
urlString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; // PATCH
NSURL *url = [NSURL URLWithString:urlString];
I'm guessing if I were to encode the URL's query string parameters beforehand, that would eliminate the error (and the need for the patch). However, I haven't had to use encodeURIComponent() on either the q or api-key query string parameters for any other client environment (e.g. cordova + android, web apps, older versions ios + cordova), so I wanted to document this situation for others that may experience it.
Thank you again, and I hope this is helpful.