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?
lib/net/http/header.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/net/http/header.rb, line 699
def chunked?
return false unless @header['transfer-encoding']
field = self['Transfer-Encoding']
(/(?:\A|[^\-\w])chunked(?![\-\w])\s*(?:,\s*)*\z/i =~ field) ? true : false
end
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.
See also
#canonical_each
#connection_close?
#basic_auth
#connection_keep_alive?
also in
4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0