class Routemaster::Middleware::RootPostOnly
Rejects all requests but POST to the root path
Public Class Methods
new(app, _options = {})
click to toggle source
# File lib/routemaster/middleware/root_post_only.rb, line 5 def initialize(app, _options = {}) @app = app end
Public Instance Methods
call(env)
click to toggle source
# File lib/routemaster/middleware/root_post_only.rb, line 9 def call(env) return [404, {}, []] unless ['', '/'].include? env['PATH_INFO'] return [405, {}, []] if env['REQUEST_METHOD'] != 'POST' @app.call(env) end