aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/response_test.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-08-09 13:38:29 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-08-09 13:38:29 -0700
commit6794e92b204572d75a07bd6413bdae6ae22d5a82 (patch)
treedfec13e94add6c7c181cda11b13f56a4b7e1baf1 /actionpack/test/dispatch/response_test.rb
parent6a3d4695f043031b73b1f5bc218fbeeae9fff771 (diff)
parent98c18d0058a01e47f3acb10b3a105d79bd1597bf (diff)
downloadrails-6794e92b204572d75a07bd6413bdae6ae22d5a82.tar.gz
rails-6794e92b204572d75a07bd6413bdae6ae22d5a82.tar.bz2
rails-6794e92b204572d75a07bd6413bdae6ae22d5a82.zip
Merge pull request #7302 from homakov/default_headers
Introduce default_headers. closes #6311 #6515
Diffstat (limited to 'actionpack/test/dispatch/response_test.rb')
-rw-r--r--actionpack/test/dispatch/response_test.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/response_test.rb b/actionpack/test/dispatch/response_test.rb
index e2903d4b36..71609d7340 100644
--- a/actionpack/test/dispatch/response_test.rb
+++ b/actionpack/test/dispatch/response_test.rb
@@ -176,6 +176,33 @@ class ResponseTest < ActiveSupport::TestCase
ActionDispatch::Response.default_charset = original
end
end
+
+ test "read x_frame_options and x_xss_protection" do
+ ActionDispatch::Response.default_headers = {
+ 'X-Frame-Options' => 'DENY',
+ 'X-XSS-Protection' => '1;'
+ }
+ resp = ActionDispatch::Response.new.tap { |response|
+ response.body = 'Hello'
+ }
+ resp.to_a
+
+ assert_equal('DENY', resp.headers['X-Frame-Options'])
+ assert_equal('1;', resp.headers['X-XSS-Protection'])
+ end
+
+ test "read custom default_header" do
+ ActionDispatch::Response.default_headers = {
+ 'X-XX-XXXX' => 'Here is my phone number'
+ }
+ resp = ActionDispatch::Response.new.tap { |response|
+ response.body = 'Hello'
+ }
+ resp.to_a
+
+ assert_equal('Here is my phone number', resp.headers['X-XX-XXXX'])
+ end
+
end
class ResponseIntegrationTest < ActionDispatch::IntegrationTest