ruby-changes:47805
From: naruse <ko1@a...>
Date: Sat, 16 Sep 2017 01:54:01 +0900 (JST)
Subject: [ruby-changes:47805] naruse:r59923 (trunk): include query parameters in Net::HTTP.post
naruse 2017-09-16 01:53:55 +0900 (Sat, 16 Sep 2017) New Revision: 59923 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59923 Log: include query parameters in Net::HTTP.post patched by Samuel Giddins <segiddins@s...> https://github.com/ruby/ruby/pull/1686 fix GH-1686 Modified files: trunk/lib/net/http.rb trunk/test/net/http/test_http.rb Index: test/net/http/test_http.rb =================================================================== --- test/net/http/test_http.rb (revision 59922) +++ test/net/http/test_http.rb (revision 59923) @@ -431,12 +431,13 @@ module TestNetHTTP_version_1_1_methods https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http.rb#L431 end def test_s_post - url = "http://#{config('host')}:#{config('port')}/" + url = "http://#{config('host')}:#{config('port')}/?q=a" res = Net::HTTP.post( URI.parse(url), "a=x") assert_equal "application/x-www-form-urlencoded", res["Content-Type"] assert_equal "a=x", res.body + assert_equal url, res["X-request-uri"] res = Net::HTTP.post( URI.parse(url), Index: lib/net/http.rb =================================================================== --- lib/net/http.rb (revision 59922) +++ lib/net/http.rb (revision 59923) @@ -503,7 +503,7 @@ module Net #:nodoc: https://github.com/ruby/ruby/blob/trunk/lib/net/http.rb#L503 def HTTP.post(url, data, header = nil) start(url.hostname, url.port, :use_ssl => url.scheme == 'https' ) {|http| - http.post(url.path, data, header) + http.post(url, data, header) } end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/