diff options
author | Tom Kadwill <tomkadwill@gmail.com> | 2016-05-12 07:05:41 +0100 |
---|---|---|
committer | Tom Kadwill <tomkadwill@gmail.com> | 2016-05-12 18:46:16 +0100 |
commit | 775703e1f9b99500ecc362fd0eef5212b3580619 (patch) | |
tree | 3afab0dc2b713867a689efed603ac008ad239a84 /actionpack/lib | |
parent | 548c1d6e8b819ca4e02e6218b67107c580ee65f2 (diff) | |
download | rails-775703e1f9b99500ecc362fd0eef5212b3580619.tar.gz rails-775703e1f9b99500ecc362fd0eef5212b3580619.tar.bz2 rails-775703e1f9b99500ecc362fd0eef5212b3580619.zip |
Document and test ActionDispatch server_port
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/http/url.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb index b7a6aeee7d..7a1350a46d 100644 --- a/actionpack/lib/action_dispatch/http/url.rb +++ b/actionpack/lib/action_dispatch/http/url.rb @@ -354,6 +354,17 @@ module ActionDispatch standard_port? ? '' : ":#{port}" end + # Returns the requested port, such as 8080, based on SERVER_PORT + # + # class Request < Rack::Request + # include ActionDispatch::Http::URL + # end + # + # req = Request.new 'SERVER_PORT' => '80' + # req.server_port # => 80 + # + # req = Request.new 'SERVER_PORT' => '8080' + # req.server_port # => 8080 def server_port get_header('SERVER_PORT').to_i end |