lib/httpx/plugins/multipart/part.rb in httpx-0.16.1 vs lib/httpx/plugins/multipart/part.rb in httpx-0.17.0
- old
+ new
@@ -6,21 +6,21 @@
module_function
def call(value)
# take out specialized objects of the way
if value.respond_to?(:filename) && value.respond_to?(:content_type) && value.respond_to?(:read)
- return [value, value.content_type, value.filename]
+ return value, value.content_type, value.filename
end
content_type = filename = nil
if value.is_a?(Hash)
content_type = value[:content_type]
filename = value[:filename]
value = value[:body]
end
- value = value.open(:binmode => true) if Object.const_defined?(:Pathname) && value.is_a?(Pathname)
+ value = value.open(File::RDONLY) if Object.const_defined?(:Pathname) && value.is_a?(Pathname)
if value.is_a?(File)
filename ||= File.basename(value.path)
content_type ||= MimeTypeDetector.call(value, filename) || "application/octet-stream"
[value, content_type, filename]