lib/faraday/parts/filepart.rb in douban_api-0.1.2 vs lib/faraday/parts/filepart.rb in douban_api-0.1.3
- old
+ new
@@ -1,10 +1,11 @@
+# -*- encoding : utf-8 -*-
# monkey patch from @liluo https://gist.github.com/4176272
class Faraday::Parts::FilePart
def initialize(boundary, name, io)
file_length = io.respond_to?(:length) ? io.length : File.size(io.local_path)
@head = build_head(boundary, name, io.original_filename, io.content_type, file_length,
io.respond_to?(:opts) ? io.opts : {})
@length = @head.length + file_length
@io = CompositeReadIO.new(StringIO.new(@head), io, StringIO.new("\r\n"))
end
-end
\ No newline at end of file
+end