rack-flash
rack-flash copied to clipboard
Doesn't work with JSON session cookies
Flash keys are automatically converted to symbols. However symbols are not supported by JSON session cookies.
require 'sinatra/base'
require 'rack/flash'
class Server < Sinatra::Application
configure do
use Rack::Session::Cookie, coder: Rack::Session::Cookie::Base64::JSON.new
use Rack::Flash
end
get '/' do
flash['foo'] = 'bar'
end
end
Server.run!
Running this sample code produces the error:
Rack::Utils::OkJson::Error at /
Hash key is not a string: :foo