mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Convert parse_request to macro
This commit is contained in:
parent
1c53321026
commit
924905f146
1 changed files with 6 additions and 10 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue