module Roda::RodaPlugins::Middleware

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

result (404 with no body), forward the result to the next middleware.
:next_if_not_found :: If the middleware handles the request but returns a not found
Defaults to false.
final response when the request is forwarded to the app.
the middleware's route block should be applied to the
:forward_response_headers :: Whether changes to the response headers made inside
and returns a response.
after either the middleware or next app handles the request
and rack response for all requests passing through the middleware,
:handle_result :: Callable object that will be called with request environment
roda middleware in the same application.
You should only need to override this if you are using multiple
application that the current request is a middleware request.
:env_var :: Set the environment variable to use to indicate to the roda
Configure the middleware plugin. Options:
def self.configure(app, opts={}, &block)
  app.opts[:middleware_env_var] = opts[:env_var] if opts.has_key?(:env_var)
  app.opts[:middleware_env_var] ||= 'roda.forward_next'
  app.opts[:middleware_configure] = block if block
  app.opts[:middleware_handle_result] = opts[:handle_result]
  app.opts[:middleware_forward_response_headers] = opts[:forward_response_headers]
  app.opts[:middleware_next_if_not_found] = opts[:next_if_not_found]
end