Actions
Feature #12375
closedNet::HTTP.post
Description
Net::HTTP.post_form is convenient, but it's dedicated to application/x-www-form-urlencoded.
Why not provide Net::HTTP.post for other media types?
res = Net::HTTP.post(URI('http://www.example.com/api/search'),
{ "q" => "ruby", "max" => "50" }.to_json,
"Content-Type" => "application/json")
I've attached a patch, but there are some considerations:
- Net::HTTP.post_form supports basic authentication by userinfo in URLs,
but Net::HTTP.post doesn't, because it's deprecated by RFC3986.
Is it OK? - The first argument must be a URI object, but it might be better to accept a String.
- Should methods for other HTTP methods such as Net::HTTP.patch be added?
Files
Actions
Like0
Like0Like0Like0Like0Like0Like0