require 'yaml' require 'sinatra' require 'sinatra/contrib' set :logging, false get '/' do cookies.map { |k, v| k.to_s + v.to_s }.join( "\n" ) end get '/submit' do cookies.to_hash.to_yaml end get '/sleep' do sleep 2 <<-EOHTML Inject here #{cookies[:input]} EOHTML end get '/set_cookie' do cookies['my-cookie'] = 'my-val' '' end get '/with_other_elements' do cookies['mycookie'] ||= 'cookie val' <A link
HTML end