mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Simplify query_params
This commit is contained in:
parent
340d2fbf8e
commit
2b9484c896
1 changed files with 6 additions and 4 deletions
|
@ -23,10 +23,12 @@ module Puma
|
|||
# parameter (which defaults to '&;'.
|
||||
def self.query_parse(qs, d = '&;')
|
||||
params = {}
|
||||
(qs||'').split(/[#{d}] */n).inject(params) { |h,p|
|
||||
k, v=unescape(p).split('=',2)
|
||||
|
||||
qs.split(/[#{d}] */n).each do |p|
|
||||
k, v = unescape(p).split('=', 2)
|
||||
|
||||
if cur = params[k]
|
||||
if cur.class == Array
|
||||
if cur.kind_of? Array
|
||||
params[k] << v
|
||||
else
|
||||
params[k] = [cur, v]
|
||||
|
@ -34,7 +36,7 @@ module Puma
|
|||
else
|
||||
params[k] = v
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
return params
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue