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(302, {'Location': 'http://localhost:8000/'});
15 var body = "Hello World";
17 "Content-Type": "text/plain",
18 "Content-Length": Buffer.byteLength(body),
19 "Date": "Thu, 30 Aug 2012 18:17:53 GMT",
22 res.write("Hello World");
28 xhr.onreadystatechange = function() {
29 if (this.readyState == 4) {
30 assert.equal(xhr.getRequestHeader('Location'), '');
31 assert.equal(xhr.responseText, "Hello World");
37 xhr.open("GET", "http://localhost:8000/redirectingResource");
40 console.log("ERROR: Exception raised", e);