chunks

Sets the chunks to stream from a List.

Replaces any chunks previously added via chunk or an earlier chunks call. If you need to combine bulk initialization with individual additions, call chunks first and then chunk.

Return

This builder instance.

Parameters

chunks

The list of chunks to stream.

See also


Sets the chunks to stream from a Stream.

The stream is consumed lazily — it is drained only when the first matching HTTP request arrives, not when this method is called. This means a stream backed by a live generator or a mutable source will reflect its state at request time rather than at stub-registration time.

Because Stream is single-use, reusing the same stream instance across multiple request matches will throw on the second match. If the stub may match more than once, supply a fresh Stream per registration or prefer chunks with a List instead.

Replaces any chunks previously added via chunk or an earlier chunks call.

Return

This builder instance.

Parameters

chunks

The stream of chunks to send. Must not have been previously consumed.

See also