module Roda::RodaPlugins::Cookies
The cookies plugin adds response methods for handling cookies. Currently, you can set cookies with set_cookie
and delete cookies with delete_cookie
:
response.set_cookie('foo', 'bar') response.delete_cookie('foo')
Pass
a hash of cookie options when loading the plugin to set some defaults for all cookies upon setting and deleting. This is particularly useful for configuring the domain
and path
of all cookies.
plugin :cookies, domain: 'example.com', path: '/api'
Public Class Methods
Source
# File lib/roda/plugins/cookies.rb, line 22 def self.configure(app, opts={}) app.opts[:cookies_opts] = (app.opts[:cookies_opts]||{}).merge(opts).freeze end
Allow setting default cookie options when loading the cookies plugin.