Skip to content
instance method

Net::HTTPHeader#each_name

() { (::String) -> untyped } -> ::Hash[::String, ::Array[::String]]
() -> ::Enumerator[::String, ::Hash[::String, ::Array[::String]]]
each_name() { |key| ... }

Calls the block with each field key:

Example
res = Net::HTTP.get_response(hostname, '/todos/1')
res.each_key do |key|
  p key if key.start_with?('c')
end

Output:

Example
"content-type"
"connection"
"cache-control"
"cf-cache-status"
"cf-ray"

Returns an enumerator if no block is given.

Net::HTTPHeader#each_name is an alias for Net::HTTPHeader#each_key.

See also #each_key #each_value #each_header #fetch also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0