diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-15 16:53:55 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-15 16:53:55 +0000 |
commit | 16225d823dcf26fcdf294080c95fd6a4915a30e6 (patch) | |
tree | e74b2b7443495df0498380aa0a7e5711cb785b39 | |
parent | 743ab3c78371f399e10bd36abbe5de7fff9bf71f (diff) |
include query parameters in Net::HTTP.post
patched by Samuel Giddins <segiddins@segiddins.me>
https://github.com/ruby/ruby/pull/1686 fix GH-1686
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | lib/net/http.rb | 2 | ||||
-rw-r--r-- | test/net/http/test_http.rb | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb index d632020458..a4b919e59b 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -503,7 +503,7 @@ module Net #:nodoc: 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 diff --git a/test/net/http/test_http.rb b/test/net/http/test_http.rb index 7ec08f5d1e..d22b3dea3d 100644 --- a/test/net/http/test_http.rb +++ b/test/net/http/test_http.rb @@ -431,12 +431,13 @@ module TestNetHTTP_version_1_1_methods 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), |