I\'m writing a rack middleware component for a rails app that will need to conditionally set cookies. I am currently trying to figure out to set cookies. From googling around
You can also use the Rack::Utils
library to set and delete headers without creating a Rack::Response object.
class RackApp
def initialize(app)
@app = app
end
def call(env)
status, headers, body = @app.call(env)
Rack::Utils.set_cookie_header!(headers, "foo", {:value => "bar", :path => "/"})
[status, headers, body]
end
end