module Roda::RodaPlugins::RouteCsrf

def self.configure(app, opts=OPTS, &block)

def self.configure(app, opts=OPTS, &block)
  options = app.opts[:route_csrf] = (app.opts[:route_csrf] || DEFAULTS).merge(opts)
  if block
    if opts[:csrf_failure]
      raise RodaError, "Cannot specify both route_csrf plugin block and :csrf_failure option"
    end
    options[:csrf_failure] = block
  end
  options[:env_header] = "HTTP_#{options[:header].to_s.gsub('-', '_').upcase}".freeze
  options.freeze
end