aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorJonas Baumann <jone@jone.ch>2015-01-09 16:55:02 +0100
committerJonas Baumann <jone@jone.ch>2015-01-09 16:55:02 +0100
commit0739480f458f90d79dbf9d14a8340c6b913f9c51 (patch)
treefd4be7ca13e1de80cd3265ec0b1c4ea2115f173f /actionpack/test/controller
parent6f9eab9ebe03cdb3bd0aa9a6e2b3ece0ed354311 (diff)
downloadrails-0739480f458f90d79dbf9d14a8340c6b913f9c51.tar.gz
rails-0739480f458f90d79dbf9d14a8340c6b913f9c51.tar.bz2
rails-0739480f458f90d79dbf9d14a8340c6b913f9c51.zip
Default headers, removed in controller actions, will not be reapplied to the test response.
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/integration_test.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb
index 5535c7ae78..5c0651bd73 100644
--- a/actionpack/test/controller/integration_test.rb
+++ b/actionpack/test/controller/integration_test.rb
@@ -279,6 +279,11 @@ class IntegrationProcessTest < ActionDispatch::IntegrationTest
def redirect
redirect_to action_url('get')
end
+
+ def remove_default_header
+ response.headers.except! 'X-Frame-Options'
+ head :ok
+ end
end
def test_get
@@ -506,6 +511,24 @@ class IntegrationProcessTest < ActionDispatch::IntegrationTest
end
end
+ def test_removed_default_headers_on_test_response_are_not_reapplied
+ with_test_route_set do
+ begin
+ header_to_remove = 'X-Frame-Options'
+ original_default_headers = ActionDispatch::Response.default_headers
+ ActionDispatch::Response.default_headers = {
+ 'X-Content-Type-Options' => 'nosniff',
+ header_to_remove => 'SAMEORIGIN',
+ }
+ get '/remove_default_header'
+ assert_includes headers, 'X-Content-Type-Options'
+ assert_not_includes headers, header_to_remove, "Should not contain removed default header"
+ ensure
+ ActionDispatch::Response.default_headers = original_default_headers
+ end
+ end
+ end
+
private
def with_test_route_set
with_routing do |set|