socketry / multipart-post

Adds multipart POST capability to net/http
MIT License
293 stars 72 forks source link

Fixing StringIO bug in 1.9.2 #9

Closed arsduo closed 13 years ago

arsduo commented 13 years ago

Hey Nick,

Here's a fix for the StringIO bug I reported.

Without the fix, rake test produces:

(in /Users/ahkoppel2/Desktop/multipart-post)
............EF
Finished in 0.005231 seconds.

  1) Error:
test_form_multipart_body_with_stringio(Net::HTTP::Post::MultiPartTest):
NoMethodError: undefined method `path' for #<StringIO:0x000001011470b0>
    /Users/ahkoppel2/Desktop/multipart-post/lib/composite_io.rb:71:in `initialize'
    /Users/ahkoppel2/Desktop/multipart-post/test/net/http/post/test_multipart.rb:38:in `new'
    /Users/ahkoppel2/Desktop/multipart-post/test/net/http/post/test_multipart.rb:38:in `test_form_multipart_body_with_stringio'

  2) Failure:
test_works_with_ruby_192_string_ios(UploadIOTest) [/Users/ahkoppel2/Desktop/multipart-post/test/test_upload_io.rb:8]:
Exception raised:
<#<ArgumentError: wrong number of arguments (1 for 2)>>.

14 tests, 29 assertions, 1 failures, 1 errors, 0 skips

With the fix, we get

..............
Finished in 0.004948 seconds.

I originally wrote a StringIO-specific test (as you see in the results), but I removed it since one of the existing tests uses StringIOs and was failing without the fix.

Thanks again! The gem is very useful, and we're happy to help.

Best,

Alex

nicksieger commented 13 years ago

Thanks!