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 || opts[:csrf_failure].is_a?(Proc) if block && opts[:csrf_failure] raise RodaError, "Cannot specify both route_csrf plugin block and :csrf_failure option" end block ||= opts[:csrf_failure] options[:csrf_failure] = :csrf_failure_method app.define_roda_method(:_roda_route_csrf_failure, 1, &app.send(:convert_route_block, block)) end options[:env_header] = "HTTP_#{options[:header].to_s.gsub('-', '_').upcase}".freeze options.freeze end
def self.load_dependencies(app, opts=OPTS)
def self.load_dependencies(app, opts=OPTS) app.plugin :_base64 end