lib/httpx/plugins/multipart/part.rb in httpx-0.13.2 vs lib/httpx/plugins/multipart/part.rb in httpx-0.14.0
- old
+ new
@@ -17,10 +17,10 @@
content_type = value[:content_type]
filename = value[:filename]
value = value[:body]
end
- value = value.open(:binmode => true) if value.is_a?(Pathname)
+ value = value.open(:binmode => true) 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]