method
protocol
v5.0.0.1 -
Show latest stable
- Class:
ActionDispatch::Http::URL
protocol()public
Returns ‘https://’ if this is an SSL request and ‘http://’ otherwise.
class Request < Rack::Request include ActionDispatch::Http::URL end req = Request.new 'HTTP_HOST' => 'example.com' req.protocol # => "http://" req = Request.new 'HTTP_HOST' => 'example.com', 'HTTPS' => 'on' req.protocol # => "https://"