1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
naruse 2017-09-15 16:53:55 +00:00
parent 743ab3c783
commit 16225d823d
2 changed files with 3 additions and 2 deletions

View file

@ -503,7 +503,7 @@ module Net #:nodoc:
def HTTP.post(url, data, header = nil) def HTTP.post(url, data, header = nil)
start(url.hostname, url.port, start(url.hostname, url.port,
:use_ssl => url.scheme == 'https' ) {|http| :use_ssl => url.scheme == 'https' ) {|http|
http.post(url.path, data, header) http.post(url, data, header)
} }
end end

View file

@ -431,12 +431,13 @@ module TestNetHTTP_version_1_1_methods
end end
def test_s_post def test_s_post
url = "http://#{config('host')}:#{config('port')}/" url = "http://#{config('host')}:#{config('port')}/?q=a"
res = Net::HTTP.post( res = Net::HTTP.post(
URI.parse(url), URI.parse(url),
"a=x") "a=x")
assert_equal "application/x-www-form-urlencoded", res["Content-Type"] assert_equal "application/x-www-form-urlencoded", res["Content-Type"]
assert_equal "a=x", res.body assert_equal "a=x", res.body
assert_equal url, res["X-request-uri"]
res = Net::HTTP.post( res = Net::HTTP.post(
URI.parse(url), URI.parse(url),