class Async::HTTP::Reference

def encode(value, prefix = nil)

Encodes a hash or array into a query string
def encode(value, prefix = nil)
	case value
	when Array
		value.map { |v|
			encode(v, "#{prefix}[]")
		}.join("&")
	when Hash
		value.map { |k, v|
			encode(v, prefix ? "#{prefix}[#{escape(k.to_s)}]" : escape(k.to_s))
		}.reject(&:empty?).join('&')
	when nil
		prefix
	else
		raise ArgumentError, "value must be a Hash" if prefix.nil?
		"#{prefix}=#{escape(value.to_s)}"
	end
end