mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Refactor global namespace DSL into OOP Kemal::Base
This commit is contained in:
parent
a5d8df7382
commit
aaa2109837
25 changed files with 420 additions and 387 deletions
|
@ -6,8 +6,9 @@ describe "Kemal::InitHandler" do
|
|||
io = IO::Memory.new
|
||||
response = HTTP::Server::Response.new(io)
|
||||
context = HTTP::Server::Context.new(request, response)
|
||||
Kemal::InitHandler::INSTANCE.next = ->(_context : HTTP::Server::Context) {}
|
||||
Kemal::InitHandler::INSTANCE.call(context)
|
||||
init_handler = Kemal::InitHandler.new(Kemal::Base.new)
|
||||
init_handler.next = ->(context : HTTP::Server::Context) {}
|
||||
init_handler.call(context)
|
||||
context.response.headers["Content-Type"].should eq "text/html"
|
||||
end
|
||||
|
||||
|
@ -16,7 +17,8 @@ describe "Kemal::InitHandler" do
|
|||
io = IO::Memory.new
|
||||
response = HTTP::Server::Response.new(io)
|
||||
context = HTTP::Server::Context.new(request, response)
|
||||
Kemal::InitHandler::INSTANCE.call(context)
|
||||
init_handler = Kemal::InitHandler.new(Kemal::Base.new)
|
||||
init_handler.call(context)
|
||||
context.response.headers["X-Powered-By"].should eq "Kemal"
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue