mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Fixed match bug
This commit is contained in:
parent
da23d397c6
commit
c49191e650
3 changed files with 20 additions and 2 deletions
|
@ -23,7 +23,7 @@ class Kemal::Handler < HTTP::Handler
|
|||
match = route.match?(request)
|
||||
if match
|
||||
params = Kemal::ParamParser.new(route, request).parse
|
||||
context = Context.new(request, params.not_nil!)
|
||||
context = Context.new(request, params)
|
||||
begin
|
||||
body = route.handler.call(context).to_s
|
||||
return HTTP::Response.new(context.status_code, body, context.response_headers)
|
||||
|
|
|
@ -13,6 +13,11 @@ class Kemal::Route
|
|||
components = request.path.not_nil!.split "/"
|
||||
return nil unless request.method == @method
|
||||
return nil unless components.size == @components.size
|
||||
@components.zip(components) do |route_component, req_component|
|
||||
unless route_component.starts_with? ':'
|
||||
return nil unless route_component == req_component
|
||||
end
|
||||
end
|
||||
true
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue