Skip to content

Commit

Permalink
Fix redirect not passing the same headers again.
Browse files Browse the repository at this point in the history
  • Loading branch information
assaf committed Feb 7, 2012
1 parent 4470273 commit 15676f1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,9 @@ zombie.js-changelog(7) -- Changelog
===================================


Fix redirect not passing the same headers again.


## Version 0.12.13 2012-01-18

`Browser.fire` takes no options (that was an undocumented argument), and always fires events that bubble and can be
Expand Down
2 changes: 1 addition & 1 deletion lib/zombie/resources.coffee
Expand Up @@ -233,7 +233,7 @@ class Resources extends Array
error = new Error("Too many redirects, from #{URL.format(url)} to #{redirect}")
else
process.nextTick =>
@_makeRequest "GET", redirect, null, null, resource, callback
@_makeRequest "GET", redirect, null, headers, resource, callback
else
error = new Error("Redirect with no Location header, cannot follow")
else
Expand Down
6 changes: 4 additions & 2 deletions spec/xhr_spec.coffee
Expand Up @@ -106,11 +106,13 @@ Vows.describe("XMLHttpRequest").addBatch(
brains.get "/xhr/redirect/backend", (req, res)->
res.redirect "/xhr/redirect/target"
brains.get "/xhr/redirect/target", (req, res)->
res.send "redirected"
res.send "redirected " + req.headers["x-requested-with"]
browser = new Browser
browser.wants "http://localhost:3003/xhr/redirect", @callback
"should follow redirect": (browser)->
assert.equal browser.window.response, "redirected"
assert.match browser.window.response, /redirected/
"should resend headers": (browser)->
assert.match browser.window.response, /XMLHttpRequest/


"handle POST requests with no data":
Expand Down

0 comments on commit 15676f1

Please sign in to comment.