mirror of
https://github.com/silkimen/cordova-plugin-advanced-http.git
synced 2026-01-31 00:00:03 +08:00
Merge pull request #444 from alexander-gruenewald/patch-1
[Browser] Fixing error propagation in setHeaders
This commit is contained in:
11
src/browser/cordova-http-plugin.js
vendored
11
src/browser/cordova-http-plugin.js
vendored
@@ -237,7 +237,16 @@ function sendRequest(method, withData, opts, success, failure) {
|
||||
// we can't set connect timeout and read timeout separately on browser platform
|
||||
xhr.timeout = readTimeout * 1000;
|
||||
|
||||
setHeaders(xhr, headers);
|
||||
try {
|
||||
setHeaders(xhr, headers);
|
||||
} catch(error) {
|
||||
return onFail({
|
||||
status: -1,
|
||||
error: error,
|
||||
url: url,
|
||||
headers: headers
|
||||
});
|
||||
}
|
||||
|
||||
xhr.onerror = function () {
|
||||
return onFail(createXhrFailureObject(xhr));
|
||||
|
||||
Reference in New Issue
Block a user