mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Removed redundant code for more performant processing
This commit is contained in:
parent
dcba72c891
commit
0e617dcfb6
2 changed files with 3 additions and 4 deletions
|
@ -9,7 +9,7 @@ class Kemal::Handler < HTTP::Handler
|
|||
end
|
||||
|
||||
def call(request)
|
||||
response = exec_request(request)
|
||||
response = process_request(request)
|
||||
response || call_next(request)
|
||||
end
|
||||
|
||||
|
@ -17,8 +17,7 @@ class Kemal::Handler < HTTP::Handler
|
|||
@routes << Route.new(method, path, &handler)
|
||||
end
|
||||
|
||||
def exec_request(request)
|
||||
components = request.path.not_nil!.split "/"
|
||||
def process_request(request)
|
||||
@routes.each do |route|
|
||||
match = route.match?(request)
|
||||
if match
|
||||
|
|
|
@ -10,8 +10,8 @@ class Kemal::Route
|
|||
end
|
||||
|
||||
def match?(request)
|
||||
components = request.path.not_nil!.split "/"
|
||||
return nil unless request.method == @method
|
||||
components = request.path.not_nil!.split "/"
|
||||
return nil unless components.size == @components.size
|
||||
@components.zip(components) do |route_component, req_component|
|
||||
unless route_component.starts_with? ':'
|
||||
|
|
Loading…
Reference in a new issue