Eric Seidel a9776838ee Add POST support to XHR as well as .status and statusText support
Also fixed all the XHR tests to actually run and work
I learned from elliot that the it function has to
take a "done" argument to be treated asynchronously.

My utf8 conversion is a hack, but we deleted
window.TextEncoder (it was a module) when we forked.
We could resurrect TextEncoder (and probably should)
but I've left that for a separate change.

I also augmented sky_server to have a special /echo_post
handler so we can test POST requests.

R=esprehn@chromium.org
BUG=

Committed: 5ef81d249b

Review URL: https://codereview.chromium.org/810523002
2014-12-16 11:20:40 -08:00

23 lines
706 B
Plaintext

<html>
<import src="/sky/tests/resources/chai.sky" />
<import src="/sky/tests/resources/mocha.sky" />
<import src="/sky/framework/xmlhttprequest.sky" as="XMLHttpRequest" />
<script>
describe('XMLHttpRequest', function() {
it('should be able to post non-ascii', function(done) {
// example utf8, #114, "I can eat glass" in arabic.
// http://www.columbia.edu/~kermit/utf8.html
var utf8_text = "أنا قادر على أكل الزجاج و هذا لا يؤلمني.";
var xhr = new XMLHttpRequest();
xhr.onload = function() {
assert.equal(this.responseText, utf8_text);
done();
};
xhr.open("GET", "/echo_post");
xhr.send(utf8_text);
});
});
</script>
</html>