Class: Net::HTTP::Get

Inherits:
Net::HTTPRequest show all
Defined in:
lib/net/http/requests.rb

Overview

Class for representing HTTP method GET:

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:

Related:

  • Net::HTTP.get: sends GET request, returns response body.

  • Net::HTTP#get: sends GET request, returns response object.

Constant Summary collapse

METHOD =
'GET'
REQUEST_HAS_BODY =
false
RESPONSE_HAS_BODY =
true

Constants included from Net::HTTPHeader

Net::HTTPHeader::MAX_FIELD_LENGTH, Net::HTTPHeader::MAX_KEY_LENGTH

Instance Attribute Summary

Attributes inherited from Net::HTTPGenericRequest

#body, #body_stream, #decode_content, #method, #path, #uri

Method Summary

Methods inherited from Net::HTTPRequest

#initialize

Methods inherited from Net::HTTPGenericRequest

#[]=, #body_exist?, #exec, #initialize, #inspect, #request_body_permitted?, #response_body_permitted?, #set_body_internal, #update_uri

Methods included from Net::HTTPHeader

#[], #[]=, #add_field, #basic_auth, #chunked?, #connection_close?, #connection_keep_alive?, #content_length, #content_length=, #content_range, #content_type, #delete, #each_capitalized, #each_capitalized_name, #each_header, #each_name, #each_value, #fetch, #get_fields, #initialize_http_header, #key?, #main_type, #proxy_basic_auth, #range, #range_length, #set_content_type, #set_form, #set_form_data, #set_range, #size, #sub_type, #to_hash, #type_params

Constructor Details

This class inherits a constructor from Net::HTTPRequest