lib/roda/plugins/csrf.rb in roda-2.5.1 vs lib/roda/plugins/csrf.rb in roda-2.6.0

- old
+ new

@@ -22,10 +22,19 @@ module Csrf CSRF = ::Rack::Csrf # Load the Rack::Csrf middleware into the app with the given options. def self.configure(app, opts={}) - app.use CSRF, opts + app.instance_exec do + @middleware.each do |(mid, *rest), _| + if mid.equal?(CSRF) + rest[0].merge!(opts) + build_rack_app + return + end + end + use CSRF, opts + end end module InstanceMethods # The name of the hidden/meta csrf tag. def csrf_field