Merge pull request #109 from jmoriau/decoupled-urlparams-from-routehandler

Decoupled urlparams from routehandler.
This commit is contained in:
Serdar Dogruyol 2016-02-19 14:38:14 +02:00
commit 6bff31132a
3 changed files with 2 additions and 2 deletions

View file

@ -3,6 +3,7 @@
class HTTP::Server
class Context
def params
@request.url_params = route_lookup.params
@params ||= Kemal::ParamParser.new(@request).parse
end

View file

@ -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

View file

@ -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