From 8f6b00ba556f651bdccc16a20ddc47bcc4af634c Mon Sep 17 00:00:00 2001 From: Joris Moriau Date: Fri, 19 Feb 2016 11:34:45 +0100 Subject: [PATCH] decoupled-urlparams-from-routehandler --- src/kemal/context.cr | 1 + src/kemal/param_parser.cr | 2 +- src/kemal/route_handler.cr | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kemal/context.cr b/src/kemal/context.cr index 44de33d..84867db 100644 --- a/src/kemal/context.cr +++ b/src/kemal/context.cr @@ -3,6 +3,7 @@ class HTTP::Server class Context def params + @request.url_params = route_lookup.params @params ||= Kemal::ParamParser.new(@request).parse end diff --git a/src/kemal/param_parser.cr b/src/kemal/param_parser.cr index e6ee8dd..ad0bf45 100644 --- a/src/kemal/param_parser.cr +++ b/src/kemal/param_parser.cr @@ -18,10 +18,10 @@ class Kemal::ParamParser end def parse_request - parse_url_params parse_query parse_body parse_json + parse_url_params @params end diff --git a/src/kemal/route_handler.cr b/src/kemal/route_handler.cr index 96128f6..44f5ff0 100644 --- a/src/kemal/route_handler.cr +++ b/src/kemal/route_handler.cr @@ -33,7 +33,6 @@ class Kemal::RouteHandler < HTTP::Handler def process_request(context) raise Kemal::Exceptions::RouteNotFound.new(context) unless context.route_defined? route = context.route_lookup.payload as Route - context.request.url_params = context.route_lookup.params context.response.print(route.handler.call(context).to_s) context end