mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Rename common_log_handler and common_exception_handler
This commit is contained in:
parent
ac56973663
commit
5d737ee8f3
6 changed files with 21 additions and 21 deletions
|
@ -1,6 +1,6 @@
|
|||
require "./spec_helper"
|
||||
|
||||
describe "Kemal::CommonExceptionHandler" do
|
||||
describe "Kemal::ExceptionHandler" do
|
||||
it "renders 404 on route not found" do
|
||||
get "/" do |env|
|
||||
"Hello"
|
||||
|
@ -10,7 +10,7 @@ describe "Kemal::CommonExceptionHandler" do
|
|||
io = IO::Memory.new
|
||||
response = HTTP::Server::Response.new(io)
|
||||
context = HTTP::Server::Context.new(request, response)
|
||||
Kemal::CommonExceptionHandler::INSTANCE.call(context)
|
||||
Kemal::ExceptionHandler::INSTANCE.call(context)
|
||||
response.close
|
||||
io.rewind
|
||||
response = HTTP::Client::Response.from_io(io, decompress: false)
|
||||
|
@ -28,8 +28,8 @@ describe "Kemal::CommonExceptionHandler" do
|
|||
io = IO::Memory.new
|
||||
response = HTTP::Server::Response.new(io)
|
||||
context = HTTP::Server::Context.new(request, response)
|
||||
Kemal::CommonExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
|
||||
Kemal::CommonExceptionHandler::INSTANCE.call(context)
|
||||
Kemal::ExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
|
||||
Kemal::ExceptionHandler::INSTANCE.call(context)
|
||||
response.close
|
||||
io.rewind
|
||||
response = HTTP::Client::Response.from_io(io, decompress: false)
|
||||
|
@ -49,8 +49,8 @@ describe "Kemal::CommonExceptionHandler" do
|
|||
io = IO::Memory.new
|
||||
response = HTTP::Server::Response.new(io)
|
||||
context = HTTP::Server::Context.new(request, response)
|
||||
Kemal::CommonExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
|
||||
Kemal::CommonExceptionHandler::INSTANCE.call(context)
|
||||
Kemal::ExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
|
||||
Kemal::ExceptionHandler::INSTANCE.call(context)
|
||||
response.close
|
||||
io.rewind
|
||||
response = HTTP::Client::Response.from_io(io, decompress: false)
|
||||
|
@ -71,8 +71,8 @@ describe "Kemal::CommonExceptionHandler" do
|
|||
io = IO::Memory.new
|
||||
response = HTTP::Server::Response.new(io)
|
||||
context = HTTP::Server::Context.new(request, response)
|
||||
Kemal::CommonExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
|
||||
Kemal::CommonExceptionHandler::INSTANCE.call(context)
|
||||
Kemal::ExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
|
||||
Kemal::ExceptionHandler::INSTANCE.call(context)
|
||||
response.close
|
||||
io.rewind
|
||||
response = HTTP::Client::Response.from_io(io, decompress: false)
|
||||
|
@ -93,8 +93,8 @@ describe "Kemal::CommonExceptionHandler" do
|
|||
io = IO::Memory.new
|
||||
response = HTTP::Server::Response.new(io)
|
||||
context = HTTP::Server::Context.new(request, response)
|
||||
Kemal::CommonExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
|
||||
Kemal::CommonExceptionHandler::INSTANCE.call(context)
|
||||
Kemal::ExceptionHandler::INSTANCE.next = Kemal::RouteHandler::INSTANCE
|
||||
Kemal::ExceptionHandler::INSTANCE.call(context)
|
||||
response.close
|
||||
io.rewind
|
||||
response = HTTP::Client::Response.from_io(io, decompress: false)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
require "./spec_helper"
|
||||
|
||||
describe "Kemal::CommonLogHandler" do
|
||||
describe "Kemal::LogHandler" do
|
||||
it "logs to the given IO" do
|
||||
config = Kemal.config
|
||||
io = IO::Memory.new
|
||||
logger = Kemal::CommonLogHandler.new io
|
||||
logger = Kemal::LogHandler.new io
|
||||
logger.write "Something"
|
||||
io.to_s.should eq "Something"
|
||||
end
|
||||
|
@ -15,7 +15,7 @@ describe "Kemal::CommonLogHandler" do
|
|||
context_io = IO::Memory.new
|
||||
response = HTTP::Server::Response.new(context_io)
|
||||
context = HTTP::Server::Context.new(request, response)
|
||||
logger = Kemal::CommonLogHandler.new io
|
||||
logger = Kemal::LogHandler.new io
|
||||
logger.call(context)
|
||||
io.to_s.should_not be nil
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue