Class: AntiREST
- Inherits:
-
Object
- Object
- AntiREST
- Defined in:
- lib/anti_rest.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ AntiREST
constructor
A new instance of AntiREST.
Constructor Details
#initialize(app) ⇒ AntiREST
Returns a new instance of AntiREST.
2 3 4 |
# File 'lib/anti_rest.rb', line 2 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/anti_rest.rb', line 6 def call env req = Rack::Request.new(env) if req.delete? || req.put? [403, { 'Content-Type' => 'text/html', }, ['<html><body>PUT & DELETE not supported</body></html>']] else @app.call(env) end end |