On this page
class Net::HTTP::Head
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
Properties:
Request body: optional.
Response body: no.
Safe: yes.
Idempotent: yes.
Cacheable: yes.
Related:
Net::HTTP#head
: sendsHEAD
request, returns response object.
Constants
- METHOD
- REQUEST_HAS_BODY
- RESPONSE_HAS_BODY
Ruby Core © 1993–2022 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.