diff options
author | Michael Grosser <michael@grosser.it> | 2015-08-06 17:22:22 -0700 |
---|---|---|
committer | Michael Grosser <michael@grosser.it> | 2015-08-06 17:33:32 -0700 |
commit | a278630f5f1312f6986a866d3bc455c1056e554e (patch) | |
tree | fe573f71b243371cc701dbfbd55eadcb282c1de7 /actionpack/test | |
parent | 07b2ff03d04656faccc68c83541b06e318a36ed7 (diff) | |
download | rails-a278630f5f1312f6986a866d3bc455c1056e554e.tar.gz rails-a278630f5f1312f6986a866d3bc455c1056e554e.tar.bz2 rails-a278630f5f1312f6986a866d3bc455c1056e554e.zip |
do not add common ports to HTTP_HOST
- webservers do not do it
- it makes redirect urls ugly when request.host is used for redirection
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/integration_test.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb index 0b9be8d671..dc4c32b07e 100644 --- a/actionpack/test/controller/integration_test.rb +++ b/actionpack/test/controller/integration_test.rb @@ -755,6 +755,25 @@ class MetalIntegrationTest < ActionDispatch::IntegrationTest assert_equal "http://test.com/", @request.env["HTTP_REFERER"] end + def test_ignores_common_ports_in_host + get "http://test.com" + assert_equal "test.com", @request.env["HTTP_HOST"] + + get "https://test.com" + assert_equal "test.com", @request.env["HTTP_HOST"] + end + + def test_keeps_uncommon_ports_in_host + get "http://test.com:123" + assert_equal "test.com:123", @request.env["HTTP_HOST"] + + get "http://test.com:443" + assert_equal "test.com:443", @request.env["HTTP_HOST"] + + get "https://test.com:80" + assert_equal "test.com:80", @request.env["HTTP_HOST"] + end + end class ApplicationIntegrationTest < ActionDispatch::IntegrationTest |