diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2016-05-11 22:07:27 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2016-05-11 22:07:27 +0200 |
commit | 50ef6ed4500686826997688a622496bec9b0992a (patch) | |
tree | a4b6c061ad2d70de51defaa39d54c2ee7dc59044 /actionpack/test | |
parent | 537a342a8307ebe1d5e69a7e81495f137ae571a4 (diff) | |
parent | 6b9bd2e3b08538cd74e497eb35193c51385f411e (diff) | |
download | rails-50ef6ed4500686826997688a622496bec9b0992a.tar.gz rails-50ef6ed4500686826997688a622496bec9b0992a.tar.bz2 rails-50ef6ed4500686826997688a622496bec9b0992a.zip |
Merge pull request #24982 from tomkadwill/improve_clarity_of_raw_host_with_port
Improve documentation and tests for raw_host_with_port and host_with_…
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/dispatch/request_test.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb index a4cb8ce449..781f852633 100644 --- a/actionpack/test/dispatch/request_test.rb +++ b/actionpack/test/dispatch/request_test.rb @@ -417,6 +417,11 @@ class RequestPath < BaseRequestTest end class RequestHost < BaseRequestTest + test "host without specifying port" do + request = stub_request 'HTTP_HOST' => 'rubyonrails.org' + assert_equal "rubyonrails.org", request.host_with_port + end + test "host with default port" do request = stub_request 'HTTP_HOST' => 'rubyonrails.org:80' assert_equal "rubyonrails.org", request.host_with_port @@ -427,6 +432,21 @@ class RequestHost < BaseRequestTest assert_equal "rubyonrails.org:81", request.host_with_port end + test "raw without specifying port" do + request = stub_request 'HTTP_HOST' => 'rubyonrails.org' + assert_equal "rubyonrails.org", request.raw_host_with_port + end + + test "raw host with default port" do + request = stub_request 'HTTP_HOST' => 'rubyonrails.org:80' + assert_equal "rubyonrails.org:80", request.raw_host_with_port + end + + test "raw host with non default port" do + request = stub_request 'HTTP_HOST' => 'rubyonrails.org:81' + assert_equal "rubyonrails.org:81", request.raw_host_with_port + end + test "proxy request" do request = stub_request 'HTTP_HOST' => 'glu.ttono.us:80' assert_equal "glu.ttono.us", request.host_with_port |