decoupled-urlparams-from-routehandler
This commit is contained in:
parent
43d34886c4
commit
8f6b00ba55
3 changed files with 2 additions and 2 deletions
|
@ -3,6 +3,7 @@
|
||||||
class HTTP::Server
|
class HTTP::Server
|
||||||
class Context
|
class Context
|
||||||
def params
|
def params
|
||||||
|
@request.url_params = route_lookup.params
|
||||||
@params ||= Kemal::ParamParser.new(@request).parse
|
@params ||= Kemal::ParamParser.new(@request).parse
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,10 @@ class Kemal::ParamParser
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_request
|
def parse_request
|
||||||
parse_url_params
|
|
||||||
parse_query
|
parse_query
|
||||||
parse_body
|
parse_body
|
||||||
parse_json
|
parse_json
|
||||||
|
parse_url_params
|
||||||
@params
|
@params
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ class Kemal::RouteHandler < HTTP::Handler
|
||||||
def process_request(context)
|
def process_request(context)
|
||||||
raise Kemal::Exceptions::RouteNotFound.new(context) unless context.route_defined?
|
raise Kemal::Exceptions::RouteNotFound.new(context) unless context.route_defined?
|
||||||
route = context.route_lookup.payload as Route
|
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.response.print(route.handler.call(context).to_s)
|
||||||
context
|
context
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue