User defined context store types (#339)

allow the context storage to handle any types
This commit is contained in:
Rimas Silkaitis 2017-04-06 11:43:41 -07:00 committed by Serdar Dogruyol
parent 48128696c6
commit 0b4856b741
4 changed files with 43 additions and 2 deletions

View file

@ -12,6 +12,23 @@ class CustomLogHandler < Kemal::BaseLogHandler
end
end
class TestContextStorageType
property id
@id = 1
def to_s
@id
end
end
class AnotherContextStorageType
property name
@name = "kemal-context"
end
add_context_storage_type(TestContextStorageType)
add_context_storage_type(AnotherContextStorageType)
def create_request_and_return_io(handler, request)
io = IO::Memory.new
response = HTTP::Server::Response.new(io)