lib/patron/request.rb in patron-0.4.9 vs lib/patron/request.rb in patron-0.4.10
- old
+ new
@@ -38,12 +38,12 @@
@timeout = 0
@connect_timeout = 0
@max_redirects = -1
end
- attr_accessor :url, :username, :password, :file_name, :proxy, :auth_type, :insecure
- attr_reader :action, :timeout, :connect_timeout, :max_redirects, :headers
+ attr_accessor :url, :username, :password, :file_name, :proxy, :proxy_type, :auth_type, :insecure, :multipart
+ attr_reader :action, :timeout, :connect_timeout, :max_redirects, :headers, :buffer_size
attr_reader :auth_type
# Set the type of authentication to use for this request.
#
# @param [String, Symbol] type - The type of authentication to use for this request, can be one of
@@ -67,11 +67,11 @@
end
def upload_data=(data)
@upload_data = case data
when Hash
- hash_to_string(data)
+ self.multipart ? data : hash_to_string(data)
else
data
end
end
@@ -115,9 +115,17 @@
if !new_headers.kind_of?(Hash)
raise ArgumentError, "Headers must be a hash"
end
@headers = new_headers
+ end
+
+ def buffer_size=(buffer_size)
+ if buffer_size != nil && buffer_size.to_i < 1
+ raise ArgumentError, "Buffer size must be a positive integer greater than 0 or nil"
+ end
+
+ @buffer_size = buffer_size != nil ? buffer_size.to_i : nil
end
def action_name
@action.to_s.upcase
end