[ruby/net-http] Update lib/net/http/request.rb
https://github.com/ruby/net-http/commit/e3c9011edb Co-authored-by: Peter Zhu <peter@peterzhu.ca>
This commit is contained in:
parent
dbb902fc91
commit
2047636af8
@ -54,12 +54,10 @@
|
|||||||
#
|
#
|
||||||
# A POST request may be sent using request class \Net::HTTP::Post:
|
# A POST request may be sent using request class \Net::HTTP::Post:
|
||||||
#
|
#
|
||||||
# json = {title: 'foo', body: 'bar', userId: 1}
|
|
||||||
# # => "{\"title\":\"foo\",\"body\":\"bar\",\"userId\":1}"
|
|
||||||
# _uri = uri.dup
|
# _uri = uri.dup
|
||||||
# _uri.path = '/posts'
|
# _uri.path = '/posts'
|
||||||
# req = Net::HTTP::Post.new(_uri) # => #<Net::HTTP::Post POST>
|
# req = Net::HTTP::Post.new(_uri) # => #<Net::HTTP::Post POST>
|
||||||
# req.body = json
|
# req.body = '{"title": "foo", "body": "bar", "userId": 1}'
|
||||||
# req['Content-type'] = 'application/json; charset=UTF-8'
|
# req['Content-type'] = 'application/json; charset=UTF-8'
|
||||||
# Net::HTTP.start(hostname) do |http|
|
# Net::HTTP.start(hostname) do |http|
|
||||||
# http.request(req)
|
# http.request(req)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user