Class: Rack::API::Middleware::SSL
- Inherits:
-
Object
- Object
- Rack::API::Middleware::SSL
- Defined in:
- lib/rack/api/middleware/ssl.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ SSL
constructor
A new instance of SSL.
Constructor Details
#initialize(app) ⇒ SSL
Returns a new instance of SSL.
5 6 7 |
# File 'lib/rack/api/middleware/ssl.rb', line 5 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/rack/api/middleware/ssl.rb', line 9 def call(env) request = Rack::Request.new(env) if env["rack.url_scheme"] == "https" @app.call(env) else [400, {"Content-Type" => "text/plain"}, ["Only HTTPS requests are supported by now."]] end end |