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
|
||||
|
||||
def parse_request
|
||||
if query = @request.query
|
||||
HTTP::Params.parse(query) do |key, value|
|
||||
@params[key] ||= value
|
||||
{% for part in %w{query body} %}
|
||||
if {{part.id}} = @request.{{part.id}}
|
||||
HTTP::Params.parse({{part.id}}) do |key, value|
|
||||
@params[key] ||= value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if body = @request.body
|
||||
HTTP::Params.parse(body.not_nil!) do |key, value|
|
||||
@params[key] ||= value
|
||||
end
|
||||
end
|
||||
{% end %}
|
||||
@params
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue