Properly set referer and redirect to proper location
This commit is contained in:
parent
29274f9b4b
commit
4b6558e7e5
@ -90,9 +90,13 @@ module ActionController #:nodoc:
|
||||
|
||||
def follow_redirect_with_headers(h = {})
|
||||
raise "Not a redirect! #{@status} #{@status_message}" unless redirect?
|
||||
h['HTTP_REFERER'] = current_url if current_url
|
||||
|
||||
get(interpret_uri(headers["location"].first), {}, h)
|
||||
h['HTTP_REFERER'] = request.url
|
||||
|
||||
location = headers["location"]
|
||||
location = location.first if location.is_a?(Array)
|
||||
|
||||
get(location, {}, h)
|
||||
status
|
||||
end
|
||||
end
|
||||
|
@ -131,6 +131,7 @@ describe ActionController::Integration::Session do
|
||||
before :each do
|
||||
Webrat.configuration.mode = :rails
|
||||
@integration_session = ActionController::Integration::Session.new
|
||||
@integration_session.stub!(:request => mock("request", :url => "http://source.url/"))
|
||||
@integration_session.stub!(:response => mock("response"))
|
||||
end
|
||||
|
||||
@ -167,8 +168,6 @@ describe ActionController::Integration::Session do
|
||||
end
|
||||
|
||||
it "should set the HTTP referer header" do
|
||||
@integration_session.stub!(:current_url).and_return "http://source.url/"
|
||||
|
||||
headers = {}
|
||||
|
||||
@integration_session.follow_redirect_with_headers(headers)
|
||||
|
Loading…
Reference in New Issue
Block a user