require "json" require "../handler" class Guff::Handlers::SessionHandler < Guff::Handler def call(context : HTTP::Server::Context) if cookie = context.request.cookies["guff_session"]? # get session id sid = cookie.value puts "DEBUG: session_id = #{sid}" context.request.headers["x-guff-session-id"] = sid end call_next(context) if sid = context.request.headers["x-guff-session-id"]? # FIXME: need way to delete cookie cookie = HTTP::Cookie.new("guff_session", sid) context.response.headers["set-cookie"] = cookie.to_set_cookie_header end end end