Is there a way to create a "before" filter to capture and pre-process all POST requests in Sinatra?
One way of doing this would be to create a custom condition to use in the filter:
set(:method) do |method|
method = method.to_s.upcase
condition { request.request_method == method }
end
before :method => :post do
puts "pre-process POST"
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With