Class: TheProtector::Middleware
- Inherits:
-
Object
- Object
- TheProtector::Middleware
- Defined in:
- lib/the_protector/middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
3 4 5 |
# File 'lib/the_protector/middleware.rb', line 3 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/the_protector/middleware.rb', line 7 def call(env) if ENV["READ_ONLY"] == "true" if ["POST", "PUT", "PATCH", "DELETE"].include?(env["REQUEST_METHOD"]) return [503, {'Content-Type' => 'text/plain'}, ['Service Unavailable']] end end @app.call(env) end |