Method: ActionDispatch::Http::URL#protocol
- Defined in:
- actionpack/lib/action_dispatch/http/url.rb
#protocol ⇒ Object
Returns ‘https://’ if this is an SSL request and ‘http://’ otherwise.
req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com'
req.protocol # => "http://"
req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com', 'HTTPS' => 'on'
req.protocol # => "https://"
202 203 204 |
# File 'actionpack/lib/action_dispatch/http/url.rb', line 202 def protocol @protocol ||= ssl? ? "https://" : "http://" end |