aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/testing/integration.rb
diff options
context:
space:
mode:
authorRemo Fritzsche <dev@remofritzsche.com>2018-07-05 22:51:52 +0200
committerRafael França <rafaelmfranca@gmail.com>2018-07-05 16:51:52 -0400
commita0061d2389a178b093f0d3f64f58236ffbe088e0 (patch)
treec13832bbb96ba827310e042e91987e2790384770 /actionpack/lib/action_dispatch/testing/integration.rb
parent9ecbd64cd93af0c7efe3141e93f85e5c263e00d0 (diff)
downloadrails-a0061d2389a178b093f0d3f64f58236ffbe088e0.tar.gz
rails-a0061d2389a178b093f0d3f64f58236ffbe088e0.tar.bz2
rails-a0061d2389a178b093f0d3f64f58236ffbe088e0.zip
Pass along arguments to underlying `get` method in `follow_redirect!` (#33299)
* Allow get arguments for follow_redirect Now all arguments passed to `follow_redirect!` are passed to the underlying `get` method. This for example allows to set custom headers for the redirection request to the server. This is especially useful for setting headers that may, outside of the testing environment, be set automatically on every request, i.e. by a web application firewall. * Allow get arguments for follow_redirect [Remo Fritzsche + Rafael Mendonça França]
Diffstat (limited to 'actionpack/lib/action_dispatch/testing/integration.rb')
-rw-r--r--actionpack/lib/action_dispatch/testing/integration.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb
index f0398dc7b1..7637febd1c 100644
--- a/actionpack/lib/action_dispatch/testing/integration.rb
+++ b/actionpack/lib/action_dispatch/testing/integration.rb
@@ -50,10 +50,11 @@ module ActionDispatch
# Follow a single redirect response. If the last response was not a
# redirect, an exception will be raised. Otherwise, the redirect is
- # performed on the location header.
- def follow_redirect!
+ # performed on the location header. Any arguments are passed to the
+ # underlying call to `get`.
+ def follow_redirect!(**args)
raise "not a redirect! #{status} #{status_message}" unless redirect?
- get(response.location)
+ get(response.location, **args)
status
end
end