Class: Net::HTTP::Head
- Inherits:
-
Net::HTTPRequest
- Object
- Net::HTTPGenericRequest
- Net::HTTPRequest
- Net::HTTP::Head
- Defined in:
- lib/net/http/requests.rb
Overview
Class for representing HTTP method HEAD:
require 'net/http'
uri = URI('http://example.com')
hostname = uri.hostname # => "example.com"
req = Net::HTTP::Head.new(uri) # => #<Net::HTTP::Head HEAD>
res = Net::HTTP.start(hostname) do |http|
http.request(req)
end
See Request Headers.
Properties:
-
Request body: optional.
-
Response body: no.
-
Safe: yes.
-
Idempotent: yes.
-
Cacheable: yes.
Related:
-
Net::HTTP#head: sends
HEAD
request, returns response object.
Constant Summary collapse
- METHOD =
'HEAD'
- REQUEST_HAS_BODY =
false
- RESPONSE_HAS_BODY =
false
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
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