-
Notifications
You must be signed in to change notification settings - Fork 117
xhr-polyfill setting response status code 400 for remote https calls in airplane mode #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I created a forked repo to resolve this issue: It simply changes the HttpHandler._error = function (reqContext, error, underlyingErrorCode)
{
var isTimeout = (HttpHandler._UNDERLYING_ERROR_CODES.NSURLErrorTimedOut === underlyingErrorCode);
// Set status to -1 instead of the more common 0, because incidentally Ext JS interprets
// status 0 with a non-empty responseText string as a successful response. It does that,
// because it thinks it might have been a file:// response. So we'll use -1 instead,
// because we want the caller to be able to access the error message, and there's
// really no other property but responseText for that. An alternative would be to
// rely on an 'error' event, but Ext JS doesn't do that.
reqContext.status = -1;
reqContext.statusText = null;
reqContext.responseText = error;
reqContext.dispatchReadyStateChangeEvent(2); //HEADERS_RECIEVED
reqContext.dispatchReadyStateChangeEvent(3); //LOADING
reqContext.dispatchProgressEvent("progress");
reqContext.dispatchReadyStateChangeEvent(4); //DONE
if (isTimeout)
reqContext.dispatchProgressEvent("timeout");
else
reqContext.dispatchProgressEvent("error");
reqContext.dispatchProgressEvent("loadend");
}; |
@jacobg Will have a look into this issue and get back to you |
I have the exact same problem. Are there any news with regards to getting this resolved? |
With the latest version of cordova ios and better support for wkwebview, I stopped using this plugin. |
Here is the relevant code:
cordova-plugin-wkwebview-file-xhr/src/www/ios/xhr-polyfill.js
Lines 666 to 679 in 510de93
Why does it do that? An application should expect 0 status code for network issues, and defined http status codes such as 400 should be expected to only be what comes back from server.
The text was updated successfully, but these errors were encountered: