Class: RackTestCookieDisabler::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/racktest_cookie_disabler/middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ Middleware

Returns a new instance of Middleware.



3
4
5
# File 'lib/racktest_cookie_disabler/middleware.rb', line 3

def initialize(app, options = {})
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
# File 'lib/racktest_cookie_disabler/middleware.rb', line 7

def call(env)
  if env['CAPYBARA_DISABLE_COOKIES']
      env.delete('HTTP_COOKIE')
  end
  @app.call(env)
end