Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

Net::HTTPHeader#each_value

each_value() { |value| ... }

Calls the block with each string field value:

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

Output:

Example
"chunked"
"cf-q-config;dur=6.0000002122251e-06"
"cloudflare"

Returns an enumerator if no block is given.

See also #each_name #fetch #each_key #form_data= also in 4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0