Skip to content

Doesn't work with JSON session cookies #15

@gdelugre

Description

@gdelugre

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions