From 352d0a8488e874ea3002f90f20846f3273e9aa8e Mon Sep 17 00:00:00 2001 From: Dmitri Dolguikh Date: Thu, 15 Nov 2012 19:42:46 +0000 Subject: [PATCH] explicit check for Hash during payload generation. At least one library (hashery) defines :read on Hash Signed-off-by: Dmitri Dolguikh --- lib/restclient/payload.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/restclient/payload.rb b/lib/restclient/payload.rb index 77b2d31..cba7c75 100644 --- a/lib/restclient/payload.rb +++ b/lib/restclient/payload.rb @@ -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