ruby-changes:53016
From: aycabta <ko1@a...>
Date: Sat, 20 Oct 2018 20:09:40 +0900 (JST)
Subject: [ruby-changes:53016] aycabta:r65230 (trunk): Improve doc of multipart/form-data [Bug #15019]
aycabta 2018-10-20 20:09:34 +0900 (Sat, 20 Oct 2018) New Revision: 65230 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65230 Log: Improve doc of multipart/form-data [Bug #15019] * lib/net/http.rb: Documentation for Net::HTTP claims that multipart/form-data is not supported, but Net::HTTPHeader#set_form supports it since 1.9.3. Modified files: trunk/lib/net/http.rb Index: lib/net/http.rb =================================================================== --- lib/net/http.rb (revision 65229) +++ lib/net/http.rb (revision 65230) @@ -186,13 +186,10 @@ module Net #:nodoc: https://github.com/ruby/ruby/blob/trunk/lib/net/http.rb#L186 # res.value # end # - # At this time Net::HTTP does not support multipart/form-data. To send - # multipart/form-data use Net::HTTPRequest#body= and - # Net::HTTPRequest#content_type=: + # To send multipart/form-data use Net::HTTPHeader#set_form # # req = Net::HTTP::Post.new(uri) - # req.body = multipart_data - # req.content_type = 'multipart/form-data' + # req.set_form([['upload', File.open('foo.bar')]], 'multipart/form-data') # # Other requests that can contain a body such as PUT can be created in the # same way using the corresponding request class (Net::HTTP::Put). -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/