lib/rquest/requestor.rb in rquest-1.0.3 vs lib/rquest/requestor.rb in rquest-1.0.4

- old
+ new

@@ -7,10 +7,11 @@ end def update( settings={} ) @settings ||= {} @settings = @settings.merge( settings ) + @settings[:form_type] ||= :http apply_default_settings merge_settings @verb = @settings[:verb].to_sym merge_string_and_hash_params @uri = URI::parse( @settings[:uri] ) @@ -114,10 +115,14 @@ def set_body unless @files.any? klass = Rquest::client_class_for_verb( @verb ) @http_request_client = klass.send(:new, uri_path) - @http_request_client.set_form_data( @settings[:payload] ) + if @settings[:form_type] == :http + @http_request_client.set_form_data( @settings[:payload] ) + elsif @settings[:form_type] == :json + @http_request_client.body = @settings[:payload].to_json + end else klass = Rquest::client_class_for_verb( @verb, true ) multi_part_params = @settings[:payload].merge( @files ) @http_request_client = klass.send(:new, @uri.path, multi_part_params) end