Class: Net::HTTP::Head
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
|
|
Instance Chain:
|
|
Inherits: |
Net::HTTPRequest
|
Defined in: | lib/net/http/requests.rb |
Overview
Class for representing {Net::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:
-
#head: sends
HEAD
request, returns response object.
Constant Summary
-
METHOD =
# File 'lib/net/http/requests.rb', line 63'HEAD'
-
REQUEST_HAS_BODY =
# File 'lib/net/http/requests.rb', line 64false
-
RESPONSE_HAS_BODY =
# File 'lib/net/http/requests.rb', line 65false
::Net::HTTPHeader
- Included
Class Method Summary
::Net::HTTPRequest
- Inherited
.new | Creates an |
::Net::HTTPGenericRequest
- Inherited
Instance Attribute Summary
::Net::HTTPGenericRequest
- Inherited
#body | Returns the string body for the request, or |
#body= | Sets the body for the request: |
#body_stream | Returns the body stream object for the request, or |
#body_stream= | Sets the body stream for the request: |
#decode_content | Returns |
#method | Returns the string method name for the request: |
#path | Returns the string path for the request: |
#request_body_permitted? | Returns whether the request may have a body: |
#response_body_permitted? | Returns whether the response may have a body: |
#uri | Returns the URI object for the request, or |
#body_exist? |
::Net::HTTPHeader
- Included
#chunked? | Returns |
#connection_close? | Returns whether the |
#connection_keep_alive? | Returns whether the |
#content_length | Returns the value of field |
#content_length= | Sets the value of field |
Instance Method Summary
::Net::HTTPGenericRequest
- Inherited
#encode_multipart_form_data, #flush_buffer, | |
#inspect | Returns a string representation of the request: |
#quote_string, #send_request_with_body, #send_request_with_body_data, #send_request_with_body_stream, #supply_default_content_type, | |
#wait_for_continue | Waits up to the continue timeout for a response from the server provided we’re speaking |
#write_header, | |
#[]= | Don’t automatically decode response content-encoding if the user indicates they want to handle it. |
#exec | write. |
#set_body_internal | internal use only. |
#update_uri | internal use only. |
::Net::HTTPHeader
- Included
#[] | Returns the string field value for the case-insensitive field #key, or |
#[]= | Sets the value for the case-insensitive #key to |
#add_field | |
#basic_auth | Sets header |
#canonical_each | Alias for Net::HTTPHeader#each_capitalized. |
#content_range | Returns a Range object representing the value of field |
#content_type | Returns the media type from the value of field |
#content_type= | Alias for Net::HTTPHeader#set_content_type. |
#delete | Removes the header for the given case-insensitive #key (see |
#each | Alias for Net::HTTPHeader#each_header. |
#each_capitalized | Like |
#each_capitalized_name | Calls the block with each capitalized field name: |
#each_header | Calls the block with each key/value pair: |
#each_key | Alias for Net::HTTPHeader#each_name. |
#each_name | Calls the block with each field key: |
#each_value | Calls the block with each string field value: |
#fetch | With a block, returns the string value for #key if it exists; otherwise returns the value of the block; ignores the |
#form_data= | Alias for Net::HTTPHeader#set_form_data. |
#get_fields | Returns the array field value for the given #key, or |
#key? | Returns |
#main_type | Returns the leading (‘type’) part of the media type from the value of field |
#proxy_basic_auth | Sets header |
#range | Returns an array of Range objects that represent the value of field |
#range= | Alias for Net::HTTPHeader#set_range. |
#range_length | Returns the integer representing length of the value of field |
#set_content_type | Sets the value of field |
#set_form | Stores form data to be used in a |
#set_form_data | Sets the request body to a URL-encoded string derived from argument |
#set_range | Sets the value for field |
#sub_type | Returns the trailing (‘subtype’) part of the media type from the value of field |
#to_hash | Returns a hash of the key/value pairs: |
#type_params | Returns the trailing (‘parameters’) part of the value of field |
#append_field_value, #basic_encode, #capitalize, #set_field, #initialize_http_header, | |
#length | Alias for Net::HTTPHeader#size. |
#size | obsolete. |
Constructor Details
This class inherits a constructor from Net::HTTPRequest