instance method
protocol
Ruby on Rails 7.2.3
Since v3.0.20Signature
protocol()
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://"
Source
# File actionpack/lib/action_dispatch/http/url.rb, line 202
def protocol
@protocol ||= ssl? ? "https://" : "http://"
end
Defined in actionpack/lib/action_dispatch/http/url.rb line 202
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionDispatch::Http::URL