Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix for Integration::Session follow_redirect! headers['location'] bug…

… with Rack [#1555 state:resolved]

Signed-off-by: Joshua Peek <josh@joshpeek.com>
  • Loading branch information...
commit 69387ce0169b95d3a170cfb1c66a7570b1746e37 1 parent 75fa824
Christos Zisopoulos authored josh committed
View
2  actionpack/lib/action_controller/integration.rb
@@ -126,7 +126,7 @@ def host!(name)
# performed on the location header.
def follow_redirect!
raise "not a redirect! #{@status} #{@status_message}" unless redirect?
- get(interpret_uri(headers['location'].first))
+ get(interpret_uri(headers['location']))
status
end
View
12 actionpack/test/controller/integration_test.rb
@@ -30,14 +30,6 @@ def test_follow_redirect_raises_when_no_redirect
assert_raise(RuntimeError) { @session.follow_redirect! }
end
- def test_follow_redirect_calls_get_and_returns_status
- @session.stubs(:redirect?).returns(true)
- @session.stubs(:headers).returns({"location" => ["www.google.com"]})
- @session.stubs(:status).returns(200)
- @session.expects(:get)
- assert_equal 200, @session.follow_redirect!
- end
-
def test_request_via_redirect_uses_given_method
path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue"}
@session.expects(:put).with(path, args, headers)
@@ -323,6 +315,10 @@ def test_redirect
assert_equal "<html><body>You are being <a href=\"http://www.example.com/get\">redirected</a>.</body></html>", response.body
assert_kind_of HTML::Document, html_document
assert_equal 1, request_count
+
+ follow_redirect!
+ assert_response :success
+ assert_equal "/get", path
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.