Flowdock
optional_port() public

Returns a number port suffix like 8080 if the port number of this request is not the default HTTP port 80 or HTTPS port 443.

class Request < Rack::Request
  include ActionDispatch::Http::URL
end

req = Request.new 'HTTP_HOST' => 'example.com:80'
req.optional_port # => nil

req = Request.new 'HTTP_HOST' => 'example.com:8080'
req.optional_port # => 8080
Show source
Register or log in to add new notes.