Convert parse_request to macro

This commit is contained in:
Sdogruyol 2015-10-28 22:04:05 +02:00
parent 1c53321026
commit 924905f146

View file

@ -11,17 +11,13 @@ class Kemal::ParamParser
end end
def parse_request def parse_request
if query = @request.query {% for part in %w{query body} %}
HTTP::Params.parse(query) do |key, value| if {{part.id}} = @request.{{part.id}}
@params[key] ||= value HTTP::Params.parse({{part.id}}) do |key, value|
end
end
if body = @request.body
HTTP::Params.parse(body.not_nil!) do |key, value|
@params[key] ||= value @params[key] ||= value
end end
end end
{% end %}
@params @params
end end