提交 98c18d00 编写于 作者: E Egor Homakov

some tests

上级 2a290f7f
......@@ -176,6 +176,33 @@ def test_response_body_encoding
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册