class Schneiderlein::FlyCatcher

Constants

PARSE_ERROR_CONSTANT

Public Instance Methods

call(env) click to toggle source
# File lib/schneiderlein/fly_catcher.rb, line 11
def call(env)
  app.call(env)
rescue PARSE_ERROR_CONSTANT => e
  env['rack.schneiderlein.parse_errors'] ||= []
  env['rack.schneiderlein.parse_errors'] << e
  app.call(remove_errors_from(env))
end

Private Instance Methods

remove_errors_from(env) click to toggle source
# File lib/schneiderlein/fly_catcher.rb, line 21
def remove_errors_from(env)
  env['rack.input']     = StringIO.new
  env['rack.errors']    = StringIO.new
  env['RAW_POST_DATA']  = ''
  env['CONTENT_LENGTH'] = '0'
  env
end