请求之间不会保留会话,但我看不出我做错了什么。代码!
require 'sinatra'
require 'rack/fiber_pool'
class SessionTest < Sinatra::Base
use Rack::FiberPool
enable :sessions
set :session_secret, "foobar"
get '/' do
body { session.inspect } #This is always '{}'!
end
get '/a' do
session['user'] = "bob"
redirect '/'
end
end
run SessionTest.new