mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
Merge pull request #1589 from NativeScript/feature/xhr-json-fix
FIX: XHR json response sometimes is not paresed.
This commit is contained in:
@ -118,9 +118,9 @@ export class XMLHttpRequest {
|
|||||||
private _setResponseType() {
|
private _setResponseType() {
|
||||||
const contentType = this.getResponseHeader('Content-Type').toLowerCase();
|
const contentType = this.getResponseHeader('Content-Type').toLowerCase();
|
||||||
|
|
||||||
if (contentType === 'application/json') {
|
if (contentType.indexOf('application/json') >= 0) {
|
||||||
this.responseType = XMLHttpRequestResponseType.json;
|
this.responseType = XMLHttpRequestResponseType.json;
|
||||||
} else if (contentType === 'text/plain') {
|
} else if (contentType.indexOf('text/plain') >= 0) {
|
||||||
this.responseType = XMLHttpRequestResponseType.text;
|
this.responseType = XMLHttpRequestResponseType.text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user