1
0
Fork 0
mirror of https://github.com/rest-client/rest-client.git synced 2022-11-09 13:49:40 -05:00

explicit check for Hash during payload generation. At least one library (hashery) defines :read on Hash

Signed-off-by: Dmitri Dolguikh <dmitri@appliedlogic.ca>
This commit is contained in:
Dmitri Dolguikh 2012-11-15 19:42:46 +00:00
parent 616067e9bf
commit 352d0a8488

View file

@ -9,14 +9,14 @@ module RestClient
def generate(params)
if params.is_a?(String)
Base.new(params)
elsif params.respond_to?(:read)
Streamed.new(params)
elsif params
elsif params and params.is_a?(Hash)
if params.delete(:multipart) == true || has_file?(params)
Multipart.new(params)
else
UrlEncoded.new(params)
end
elsif params.respond_to?(:read)
Streamed.new(params)
else
nil
end