mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Remove redundant intermediate var from process_route
This commit is contained in:
parent
b8e3298925
commit
422313425c
2 changed files with 5 additions and 2 deletions
|
@ -32,6 +32,10 @@ class HTTP::Server
|
||||||
@response.status_code = status_code
|
@response.status_code = status_code
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def route
|
||||||
|
route_lookup.payload.as(Route)
|
||||||
|
end
|
||||||
|
|
||||||
def route_lookup
|
def route_lookup
|
||||||
Kemal::RouteHandler::INSTANCE.lookup_route(@request.override_method.as(String), @request.path)
|
Kemal::RouteHandler::INSTANCE.lookup_route(@request.override_method.as(String), @request.path)
|
||||||
end
|
end
|
||||||
|
|
|
@ -42,8 +42,7 @@ module Kemal
|
||||||
# Processes the route if it's a match. Otherwise renders 404.
|
# Processes the route if it's a match. Otherwise renders 404.
|
||||||
private def process_request(context)
|
private def process_request(context)
|
||||||
raise Kemal::Exceptions::RouteNotFound.new(context) unless context.route_defined?
|
raise Kemal::Exceptions::RouteNotFound.new(context) unless context.route_defined?
|
||||||
route = context.route_lookup.payload.as(Route)
|
content = context.route.handler.call(context)
|
||||||
content = route.handler.call(context)
|
|
||||||
ensure
|
ensure
|
||||||
if Kemal.config.error_handlers.has_key?(context.response.status_code)
|
if Kemal.config.error_handlers.has_key?(context.response.status_code)
|
||||||
raise Kemal::Exceptions::CustomException.new(context)
|
raise Kemal::Exceptions::CustomException.new(context)
|
||||||
|
|
Loading…
Reference in a new issue