mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
decoupled errors from route-handler
This commit is contained in:
parent
88aa9cd497
commit
f7975d917d
6 changed files with 61 additions and 30 deletions
|
@ -108,13 +108,14 @@ describe "Kemal::RouteHandler" do
|
|||
client_response.body.should eq("Skills ruby,crystal")
|
||||
end
|
||||
|
||||
it "renders 404 on not found" do
|
||||
kemal = Kemal::RouteHandler.new
|
||||
request = HTTP::Request.new("GET", "/?message=world")
|
||||
io_with_context = create_request_and_return_io(kemal, request)
|
||||
client_response = HTTP::Client::Response.from_io(io_with_context, decompress: false)
|
||||
client_response.status_code.should eq 404
|
||||
end
|
||||
# Removed until there is a way to test multiple middlewares
|
||||
#it "renders 404 on not found" do
|
||||
# kemal = Kemal::RouteHandler.new
|
||||
# request = HTTP::Request.new("GET", "/?message=world")
|
||||
# io_with_context = create_request_and_return_io(kemal, request)
|
||||
# client_response = HTTP::Client::Response.from_io(io_with_context, decompress: false)
|
||||
# client_response.status_code.should eq 404
|
||||
#end
|
||||
|
||||
# it "renders 500 on exception" do
|
||||
# kemal = Kemal::RouteHandler.new
|
||||
|
@ -188,13 +189,14 @@ describe "Kemal::RouteHandler" do
|
|||
client_response.status_code.should eq(200)
|
||||
end
|
||||
|
||||
it "can't process HTTP HEAD requests for undefined GET routes" do
|
||||
kemal = Kemal::RouteHandler.new
|
||||
request = HTTP::Request.new("HEAD", "/")
|
||||
io_with_context = create_request_and_return_io(kemal, request)
|
||||
client_response = HTTP::Client::Response.from_io(io_with_context, decompress: false)
|
||||
client_response.status_code.should eq(404)
|
||||
end
|
||||
# Removed until there is a way to test multiple middlewares
|
||||
#it "can't process HTTP HEAD requests for undefined GET routes" do
|
||||
# kemal = Kemal::RouteHandler.new
|
||||
# request = HTTP::Request.new("HEAD", "/")
|
||||
# io_with_context = create_request_and_return_io(kemal, request)
|
||||
# client_response = HTTP::Client::Response.from_io(io_with_context, decompress: false)
|
||||
# client_response.status_code.should eq(404)
|
||||
#end
|
||||
|
||||
it "redirects user to provided url" do
|
||||
kemal = Kemal::RouteHandler.new
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue