mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
Merge pull request #591 from NativeScript/ligaz/fix-xhr-statusText
Fix XHR statusText property to return just the text
This commit is contained in:
@ -221,6 +221,24 @@ export function test_raises_onload_Event(done) {
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
export function test_sets_status_and_statusText(done) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.onreadystatechange = () => {
|
||||
if (xhr.readyState > 3) {
|
||||
try {
|
||||
TKUnit.assertEqual(xhr.status, 200);
|
||||
TKUnit.assertEqual(xhr.statusText, 'OK');
|
||||
done(null);
|
||||
}
|
||||
catch (err) {
|
||||
done(err);
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.open("GET", "https://httpbin.org/get");
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
export function test_raises_onerror_Event(done) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.onerror = () => {
|
||||
|
@ -197,7 +197,7 @@ export class XMLHttpRequest {
|
||||
if (this._readyState === this.UNSENT || this._readyState === this.OPENED || this._errorFlag) {
|
||||
return "";
|
||||
}
|
||||
return this._status + " " + statuses[this._status];
|
||||
return statuses[this._status];
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user