mirror of
https://github.com/silkimen/cordova-plugin-advanced-http.git
synced 2026-04-24 00:00:03 +08:00
fix: #355 [Bug] [Browser] responseType "json" not working with valid JSON response
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
## 3.0.1
|
||||
|
||||
- Fixed #359: memory leakage leads to app crashes on Android
|
||||
- Fixed #355: responseType "json" not working with valid JSON response on browser (thanks millerg6711)
|
||||
|
||||
## 3.0.0
|
||||
|
||||
|
||||
Vendored
+6
-5
@@ -38,11 +38,11 @@ function serializeParams(params) {
|
||||
}
|
||||
|
||||
function decodeB64(dataString) {
|
||||
var binarString = atob(dataString);
|
||||
var bytes = new Uint8Array(binarString.length);
|
||||
var binaryString = atob(dataString);
|
||||
var bytes = new Uint8Array(binaryString.length);
|
||||
|
||||
for (var i = 0; i < binarString.length; ++i) {
|
||||
bytes[i] = binarString.charCodeAt(i);
|
||||
for (var i = 0; i < binaryString.length; ++i) {
|
||||
bytes[i] = binaryString.charCodeAt(i);
|
||||
}
|
||||
|
||||
return bytes.buffer;
|
||||
@@ -212,8 +212,9 @@ function sendRequest(method, withData, opts, success, failure) {
|
||||
break;
|
||||
}
|
||||
|
||||
// requesting text instead of JSON because it's parsed in the response handler
|
||||
xhr.responseType = responseType === 'json' ? 'text' : responseType;
|
||||
xhr.timeout = timeout * 1000;
|
||||
xhr.responseType = responseType;
|
||||
setHeaders(xhr, headers);
|
||||
|
||||
xhr.onerror = function () {
|
||||
|
||||
Reference in New Issue
Block a user