Fix for #67, Radix tree needs path style string

This commit is contained in:
Fatih Kadir Akın 2016-01-25 22:22:56 +02:00
parent c7f9de562b
commit afdb6fb793

View file

@ -27,7 +27,7 @@ class Kemal::Handler < HTTP::Handler
def process_request(context) def process_request(context)
url = context.request.path.not_nil! url = context.request.path.not_nil!
Kemal::Route.check_for_method_override!(context.request) Kemal::Route.check_for_method_override!(context.request)
lookup = @tree.find radix_path(context.request.override_method, context.request.path) lookup = @tree.find radix_path(context.request.override_method as String, context.request.path)
if lookup.found? if lookup.found?
route = lookup.payload as Route route = lookup.payload as Route
if route.match?(context.request) if route.match?(context.request)
@ -46,8 +46,8 @@ class Kemal::Handler < HTTP::Handler
return render_404(context) return render_404(context)
end end
private def radix_path(method, path) private def radix_path(method : String, path)
"#{method} #{path}" "/#{method.downcase}#{path}"
end end
private def add_to_radix_tree(method, path, route) private def add_to_radix_tree(method, path, route)