I need to read a cookie at a custom middleware. What’s the best way to achieve this? Initializing a rack request, as in the example below, doesn’t feel right.
# frozen_string_literal: true # auto_register: false module MyApp module Middlewares class MyMiddleware def initialize(app) @app = app end def call(env) # req = Rack::Request.new(env) # req.cookies @app.call(env) end end end end
What do you think?