このマニュアルは既にメンテナンスが終了したバージョンの Ruby を対象としています。 最新版のマニュアルへ

Ruby 2.5.0 リファレンスマニュアル

instance method Net::HTTPHeader#chunked?

chunked? -> bool[permalink][rdoc]

Transfer-Encoding: ヘッダフィールドが "chunked" である場合に真を返します。

Transfer-Encoding: ヘッダフィールドが存在しなかったり、 "chunked" 以外である場合には偽を返します。


require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.chunked? # => false
req["Transfer-Encoding"] = "chunked"
req.chunked? # => true