Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Net::HTTPHeader#chunked?

() -> bool
chunked?

Returns true if field 'Transfer-Encoding' exists and has 'chunked' as its final transfer coding, false otherwise; see Transfer-Encoding response header:

Example
res = Net::HTTP.get_response(hostname, '/todos/1')
res['Transfer-Encoding'] # => "chunked"
res.chunked?             # => true

'gzip, chunked' is chunked but 'chunked, gzip' is not, because only the final transfer coding frames the message. See RFC 9112 Section 6.3.