diff options
author | Tom Kadwill <tomkadwill@gmail.com> | 2016-05-11 19:06:10 +0100 |
---|---|---|
committer | Tom Kadwill <tomkadwill@gmail.com> | 2016-05-11 20:38:13 +0100 |
commit | 6b9bd2e3b08538cd74e497eb35193c51385f411e (patch) | |
tree | 814cc99b89bb409821a2e38718070fa33bde9d7f /actionpack/test/dispatch | |
parent | 0f8eefa6a581f1f04a1258342419c2896f9062ab (diff) | |
download | rails-6b9bd2e3b08538cd74e497eb35193c51385f411e.tar.gz rails-6b9bd2e3b08538cd74e497eb35193c51385f411e.tar.bz2 rails-6b9bd2e3b08538cd74e497eb35193c51385f411e.zip |
Improve documentation and tests for raw_host_with_port and host_with_port
Diffstat (limited to 'actionpack/test/dispatch')
-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 |