mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Merge pull request #49 from f/route-refactor
Implement parse_url_params
This commit is contained in:
commit
d0b62cc728
1 changed files with 12 additions and 1 deletions
|
@ -36,7 +36,18 @@ class Kemal::ParamParser
|
|||
end
|
||||
|
||||
def parse_url_params
|
||||
parse_part(@request.url_params.to_s)
|
||||
url_params = @request.url_params
|
||||
begin
|
||||
url_params = url_params.not_nil!
|
||||
name_table = url_params.regex.name_table
|
||||
size = url_params.size
|
||||
size.times do |i|
|
||||
name = name_table.fetch(i + 1) { i + 1 }
|
||||
value = url_params[i + 1]
|
||||
@params[name as String] = value
|
||||
end
|
||||
rescue
|
||||
end
|
||||
end
|
||||
|
||||
# Parses JSON request body if Content-Type is `application/json`.
|
||||
|
|
Loading…
Reference in a new issue