1 var sys = require("util")
2 , assert = require("assert")
3 , XMLHttpRequest = require("../lib/XMLHttpRequest").XMLHttpRequest
4 , xhr = new XMLHttpRequest()
5 , http = require("http");
8 var server = http.createServer(function (req, res) {
9 if (req.url === '/redirectingResource') {
10 res.writeHead(307, {'Location': 'http://localhost:8000/'});
15 assert.equal(req.method, 'POST');
17 var body = "Hello World";
19 "Content-Type": "text/plain",
20 "Content-Length": Buffer.byteLength(body),
21 "Date": "Thu, 30 Aug 2012 18:17:53 GMT",
24 res.write("Hello World");
30 xhr.onreadystatechange = function() {
31 if (this.readyState == 4) {
32 assert.equal(xhr.getRequestHeader('Location'), '');
33 assert.equal(xhr.responseText, "Hello World");
39 xhr.open("POST", "http://localhost:8000/redirectingResource");
42 console.log("ERROR: Exception raised", e);