File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -371,7 +371,7 @@ def parse_query(str)
371
371
str . split ( /[&;]/ ) . each { |x |
372
372
next if x . empty?
373
373
key , val = x . split ( /=/ , 2 )
374
- key = unescape_form ( key )
374
+ key = unescape ( key )
375
375
val = unescape_form ( val . to_s )
376
376
val = FormData . new ( val )
377
377
val . name = key
Original file line number Diff line number Diff line change @@ -93,4 +93,17 @@ def test_escape_path
93
93
assert_equal ( "/foo/bar/" , escape_path ( "/foo/bar/" ) )
94
94
assert_equal ( "/%25foo/bar/" , escape_path ( "/%foo/bar/" ) )
95
95
end
96
+
97
+ def test_parse_query
98
+ assert_equal ( { "foo" => "" } , parse_query ( "foo" ) )
99
+ assert_equal ( { "foo" => "bar" } , parse_query ( "foo=bar" ) )
100
+ assert_equal ( { "foo" => "" , "bar" => "" } , parse_query ( "foo&bar" ) )
101
+ assert_equal ( { "foo" => "" , "bar" => "" } , parse_query ( "foo;bar" ) )
102
+ assert_equal ( { "foo" => "bar" , "bar" => "baz" } , parse_query ( "foo=bar&bar=baz" ) )
103
+ assert_equal ( { "foo" => "bar" , "bar" => "baz" } , parse_query ( "foo=bar;bar=baz" ) )
104
+
105
+ bug8330 = '[ruby-core:54601]'
106
+ assert_equal ( { "foo+bar" => "" } , parse_query ( "foo+bar" ) )
107
+ assert_equal ( { "foo+bar" => "baz" } , parse_query ( "foo+bar=baz" ) )
108
+ end
96
109
end
You can’t perform that action at this time.
0 commit comments