Permalink
Browse files

Convert lack of value to an empty string, not nil.

  • Loading branch information...
1 parent edc8b92 commit 8cc9241b5e3884a4a6c46dd26ce860073e1ba1f9 @homakov committed Jun 4, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/rack/utils.rb
View
@@ -69,7 +69,8 @@ def parse_query(qs, d = nil)
(qs || '').split(d ? /[#{d}] */n : DEFAULT_SEP).each do |p|
next if p.empty?
k, v = p.split('=', 2).map { |x| unescape(x) }
- next unless k || v
+ v = '' if v.nil?
+ next unless k
if cur = params[k]
if cur.class == Array
@@ -102,6 +103,7 @@ def parse_nested_query(qs, d = nil)
def normalize_params(params, name, v = nil)
name =~ %r(\A[\[\]]*([^\[\]]+)\]*)
k = $1 || ''
+ v = '' if v.nil?
after = $' || ''
return if k.empty?

0 comments on commit 8cc9241

Please sign in to comment.