class Net::HTTP::Get
Class for representing [HTTP method GET](en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#GE T_method):
require 'net/http' uri = URI('http://example.com') hostname = uri.hostname # => "example.com" req = Net::HTTP::Get.new(uri) # => #<Net::HTTP::Get GET> res = Net::HTTP.start(hostname) do |http| http.request(req) end
See Request Headers.
Properties:
-
Request body: optional.
-
Responsebody: yes. -
[Safe](en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Safe_meth ods): yes.
-
[Idempotent](en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Ide mpotent_methods): yes.
-
[Cacheable](en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cach eable_methods): yes.
Related:
-
Net::HTTP.get: sendsGETrequest, returns response body. -
Net::HTTP#get: sendsGETrequest, returns response object.
Constants
- METHOD
- REQUEST_HAS_BODY
- RESPONSE_HAS_BODY