mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Refactor parse_url_params
This commit is contained in:
parent
d0b62cc728
commit
4c423e967f
1 changed files with 6 additions and 9 deletions
|
@ -35,18 +35,15 @@ class Kemal::ParamParser
|
|||
parse_part(@request.query)
|
||||
end
|
||||
|
||||
# Ditto: This needs memoization without the huge AllParamTypes union :|
|
||||
def parse_url_params
|
||||
url_params = @request.url_params
|
||||
begin
|
||||
url_params = url_params.not_nil!
|
||||
if @request.url_params
|
||||
url_params = @request.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
|
||||
url_params.size.times do |i|
|
||||
name = (name_table.fetch(i + 1) { i + 1 }) as String
|
||||
@params[name] = url_params[i + 1]
|
||||
end
|
||||
rescue
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue