D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Net
/
HTTP
/
Filename :
post-i.ri
back
Copy
U:RDoc::AnyMethod[iI" post:ETI"Net::HTTP#post;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I")Sends a POST request to the server; ;TI"<returns an instance of a subclass of Net::HTTPResponse.;To:RDoc::Markup::BlankLine o; ; [I"8The request is based on the Net::HTTP::Post object ;TI"Vcreated from string +path+, string +data+, and initial headers hash +initheader+.;T@o; ; [I"@With a block given, calls the block with the response body:;T@o:RDoc::Markup::Verbatim; [ I"Xdata = '{"userId": 1, "id": 1, "title": "delectus aut autem", "completed": false}' ;TI"$http = Net::HTTP.new(hostname) ;TI"(http.post('/todos', data) do |res| ;TI" p res ;TI"<end # => #<Net::HTTPCreated 201 Created readbody=true> ;T:@format0o; ; [I"Output:;T@o;; [I"�"{\n \"{\\\"userId\\\": 1, \\\"id\\\": 1, \\\"title\\\": \\\"delectus aut autem\\\", \\\"completed\\\": false}\": \"\",\n \"id\": 201\n}" ;T; 0o; ; [I"=With no block given, simply returns the response object:;T@o;; [I"Rhttp.post('/todos', data) # => #<Net::HTTPCreated 201 Created readbody=true> ;T; 0o; ; [I" Related:;T@o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0; [o; ; [I":Net::HTTP::Post: request class for \HTTP method POST.;To;;0; [o; ; [I"?Net::HTTP.post: sends POST request, returns response body.;T: @fileI"lib/net/http.rb;T:0@omit_headings_from_table_of_contents_below0I"5post(path, data, initheader = nil) {|res| ... } ;TI"body_segment;T[ I"/(path, data, initheader = nil, dest = nil);T@9FI" HTTP;TcRDoc::NormalClass00