mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fix XHR statusText property to return just the text
In order to follow the spec the XHR statusText property should return just the status text without the status code. Adding tests to guard this behavior.
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 = () => {
|
||||
|
||||
Reference in New Issue
Block a user