host_with_port() public

Returns a host:port string for this request, such as “example.com” or “example.com:8080”.

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

req = Request.new 'HTTP_HOST' => 'example.com:80'
req.host_with_port # => "example.com"

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