Skip to content

Commit

Permalink
Handle the case where the query is just a string (perhaps as parsed b…
Browse files Browse the repository at this point in the history
…y URI).
  • Loading branch information
seancribbs authored and Wesley Beary committed Nov 29, 2010
1 parent df39e85 commit e45e9a7
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/excon/connection.rb
Expand Up @@ -20,10 +20,16 @@ def request(params, &block)
params[:path] = '/' << params[:path]
end
request = params[:method].to_s.upcase << ' ' << params[:path] << '?'
for key, values in (params[:query] || @connection[:query] || {})
for value in [*values]
value_string = value && ('=' << CGI.escape(value.to_s))
request << key << value_string << '&'
query = (params[:query] || @connection[:query] || {})
case query
when String
request << query
else
for key, values in query
for value in [*values]
value_string = value && ('=' << CGI.escape(value.to_s))
request << key << value_string << '&'
end
end
end
request.chop!
Expand Down

0 comments on commit e45e9a7

Please sign in to comment.