Instance Property
count
The size of the HTTP body’s data, or
nil if it is not known.var count: Int? { get }
Discussion
Only a chunked stream is unknown, and only until something reads it: once collected the real length is reported, including when another copy of the body did the collecting. Collect one with collect(max:), data(max:) or string(max:).
An empty body is 0, not nil - its length is known, and it is zero.