Add app reference to the handlers which are bound to the app

This commit is contained in:
Johannes Müller 2017-10-18 19:48:01 +02:00 committed by sdogruyol
parent dc93bb2235
commit 72bcac6dd5
12 changed files with 58 additions and 49 deletions

View file

@ -12,11 +12,11 @@ class CustomLogHandler < Kemal::BaseLogHandler
end
end
def create_request_and_return_io(handler, request)
def create_request_and_return_io(handler, request, app = Kemal.application)
io = IO::Memory.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
context.app = Kemal.application
context.app = app
handler.call(context)
response.close
io.rewind