diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2016-08-22 17:43:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-22 17:43:47 +0200 |
commit | 46a44243065dd1088458fc843875aa531b802a47 (patch) | |
tree | 3694d0bc6d33276aa2d3c784142679542224f9f6 /actionpack/test | |
parent | eb8a1e2df8abffab82b7d7c3ddd75617c9aea4c8 (diff) | |
parent | 64f9802e90369bcf8bb906a8c7b01212e02b0e39 (diff) | |
download | rails-46a44243065dd1088458fc843875aa531b802a47.tar.gz rails-46a44243065dd1088458fc843875aa531b802a47.tar.bz2 rails-46a44243065dd1088458fc843875aa531b802a47.zip |
Merge pull request #23941 from chiragsinghal/patch-1
Return 307 status instead of 301 when rerouting POST requests to SSL
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/dispatch/ssl_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/ssl_test.rb b/actionpack/test/dispatch/ssl_test.rb index ccddb90bb5..71b274bf1e 100644 --- a/actionpack/test/dispatch/ssl_test.rb +++ b/actionpack/test/dispatch/ssl_test.rb @@ -38,6 +38,16 @@ class RedirectSSLTest < SSLTest assert_equal redirect[:body].join, @response.body end + def assert_post_redirected(redirect: {}, from: "http://a/b?c=d", + to: from.sub("http", "https")) + + self.app = build_app ssl_options: { redirect: redirect } + + post from + assert_response redirect[:status] || 307 + assert_redirected_to to + end + test "exclude can avoid redirect" do excluding = { exclude: -> request { request.path =~ /healthcheck/ } } @@ -57,6 +67,10 @@ class RedirectSSLTest < SSLTest assert_redirected end + test "http POST is redirected to https with status 307" do + assert_post_redirected + end + test "redirect with non-301 status" do assert_redirected redirect: { status: 307 } end |