D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Net
/
HTTP
/
Filename :
request-i.ri
back
Copy
U:RDoc::AnyMethod[iI"request:ETI"Net::HTTP#request;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"2Sends the given request +req+ to the server; ;TI"8forms the response into a Net::HTTPResponse object.;To:RDoc::Markup::BlankLine o; ; [I".The given +req+ must be an instance of a ;TI"S{subclass of Net::HTTPRequest}[rdoc-ref:Net::HTTPRequest@Request+Subclasses]. ;TI"DArgument +body+ should be given only if needed for the request.;T@o; ; [I"6With no block given, returns the response object:;T@o:RDoc::Markup::Verbatim; [I"$http = Net::HTTP.new(hostname) ;TI" ;TI"*req = Net::HTTP::Get.new('/todos/1') ;TI"http.request(req) ;TI".# => #<Net::HTTPOK 200 OK readbody=true> ;TI" ;TI")req = Net::HTTP::Post.new('/todos') ;TI" http.request(req, 'xyzzy') ;TI"8# => #<Net::HTTPCreated 201 Created readbody=true> ;T:@format0o; ; [I"TWith a block given, calls the block with the response and returns the response:;T@o;; [ I"*req = Net::HTTP::Get.new('/todos/1') ;TI" http.request(req) do |res| ;TI" p res ;TI"2end # => #<Net::HTTPOK 200 OK readbody=true> ;T; 0o; ; [I"Output:;T@o;; [I")#<Net::HTTPOK 200 OK readbody=false>;T; 0: @fileI"lib/net/http.rb;T:0@omit_headings_from_table_of_contents_below00I" response;T[ I"(req, body = nil);T@2FI" HTTP;TcRDoc::NormalClass00