Skip to content

Commit 34f2f16

Browse files
committed
Add sync test to test-request-protocols.js
1 parent 52ef597 commit 34f2f16

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/test-request-protocols.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,26 @@ xhr.onreadystatechange = function() {
99
if (this.readyState == 4) {
1010
assert.equal("Hello World", this.responseText);
1111
this.close();
12+
runSync();
1213
}
1314
};
1415

16+
// Async
1517
var url = "file://" + __dirname + "/testdata.txt";
1618
xhr.open("GET", url);
1719
xhr.send();
20+
21+
// Sync
22+
var runSync = function() {
23+
xhr = new XMLHttpRequest();
24+
25+
xhr.onreadystatechange = function() {
26+
if (this.readyState == 4) {
27+
assert.equal("Hello World", this.responseText);
28+
this.close();
29+
sys.puts("done");
30+
}
31+
};
32+
xhr.open("GET", url, false);
33+
xhr.send();
34+
}

0 commit comments

Comments
 (0)