lib/httpx/plugins/multipart/encoder.rb in httpx-0.11.3 vs lib/httpx/plugins/multipart/encoder.rb in httpx-0.12.0
- old
+ new
@@ -27,21 +27,16 @@
data unless length && data.empty?
end
def rewind
form = @form.each_with_object([]) do |(key, val), aux|
- v = case val
- when File
- val = val.reopen(val.path, File::RDONLY) if val.closed?
- val.rewind
- val
- else
- v
- end
- aux << [key, v]
+ val = val.reopen(val.path, File::RDONLY) if val.is_a?(File) && val.closed?
+ val.rewind if val.respond_to?(:rewind)
+ aux << [key, val]
end
@form = form
@parts = to_parts(form)
+ @part_index = 0
end
private
def to_parts(form)