Permalink
Browse files
removed parsing of quoted values
- Loading branch information...
Showing
with
2 additions
and
8 deletions.
-
+0
−6
lib/rack/utils.rb
-
+2
−2
test/spec_rack_utils.rb
|
@@ -39,9 +39,6 @@ def parse_query(qs, d = nil) |
|
|
|
|
|
|
|
(qs || '').split(d ? /[#{d}] */n : DEFAULT_SEP).each do |p| |
|
|
|
k, v = p.split('=', 2).map { |x| unescape(x) } |
|
|
|
if v =~ /^("|')(.*)\1$/ |
|
|
|
v = $2.gsub('\\'+$1, $1) |
|
|
|
end |
|
|
|
if cur = params[k] |
|
|
|
if cur.class == Array |
|
|
|
params[k] << v |
|
@@ -70,9 +67,6 @@ def parse_nested_query(qs, d = nil) |
|
|
|
module_function :parse_nested_query |
|
|
|
|
|
|
|
def normalize_params(params, name, v = nil) |
|
|
|
if v and v =~ /^("|')(.*)\1$/ |
|
|
|
v = $2.gsub('\\'+$1, $1) |
|
|
|
end |
|
|
|
name =~ %r(\A[\[\]]*([^\[\]]+)\]*) |
|
|
|
k = $1 || '' |
|
|
|
after = $' || '' |
|
|
|
@@ -33,7 +33,7 @@ |
|
|
|
Rack::Utils.parse_query("foo=bar"). |
|
|
|
should.equal "foo" => "bar" |
|
|
|
Rack::Utils.parse_query("foo=\"bar\""). |
|
|
|
should.equal "foo" => "bar" |
|
|
|
should.equal "foo" => "\"bar\"" |
|
|
|
Rack::Utils.parse_query("foo=bar&foo=quux"). |
|
|
|
should.equal "foo" => ["bar", "quux"] |
|
|
|
Rack::Utils.parse_query("foo=1&bar=2"). |
|
@@ -51,7 +51,7 @@ |
|
|
|
Rack::Utils.parse_nested_query("foo=bar"). |
|
|
|
should.equal "foo" => "bar" |
|
|
|
Rack::Utils.parse_nested_query("foo=\"bar\""). |
|
|
|
should.equal "foo" => "bar" |
|
|
|
should.equal "foo" => "\"bar\"" |
|
|
|
|
|
|
|
Rack::Utils.parse_nested_query("foo=bar&foo=quux"). |
|
|
|
should.equal "foo" => "quux" |
|
|
This comment has been minimized.
Mange commented onJul 30, 2010
dae12e0
Wonderful! :-)