lib/httpx/transcoder/multipart/encoder.rb in httpx-1.3.3 vs lib/httpx/transcoder/multipart/encoder.rb in httpx-1.3.4
- old
+ new
@@ -33,10 +33,12 @@
data unless length && data.empty?
end
def rewind
form = @form.each_with_object([]) do |(key, val), aux|
- val = val.reopen(val.path, File::RDONLY) if val.is_a?(File) && val.closed?
+ if val.respond_to?(:path) && val.respond_to?(:reopen) && val.respond_to?(:closed?) && val.closed?
+ val = val.reopen(val.path, File::RDONLY)
+ end
val.rewind if val.respond_to?(:rewind)
aux << [key, val]
end
@form = form
@parts = to_parts(form)