Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with JSON session cookies #15

Open
gdelugre opened this issue Jul 4, 2015 · 0 comments
Open

Doesn't work with JSON session cookies #15

gdelugre opened this issue Jul 4, 2015 · 0 comments

Comments

@gdelugre
Copy link

gdelugre commented Jul 4, 2015

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant