Class: RailsCookieOverflow::Middleware
- Inherits:
-
Object
- Object
- RailsCookieOverflow::Middleware
- Defined in:
- lib/rails_cookie_overflow/middleware.rb
Overview
Middleware that handles the CookieOverflow exception gracefully and returns 422 Unprocessable Entity when raised
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app) ⇒ Middleware
7 8 9 |
# File 'lib/rails_cookie_overflow/middleware.rb', line 7 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 |
# File 'lib/rails_cookie_overflow/middleware.rb', line 11 def call(env) @app.call(env) rescue ActionDispatch::Cookies::CookieOverflow [422, { "Content-Type" => "text/plain" }, ["Unprocessable Entity"]] end |