Interface IStreamSubstitution
Low level interface to substitute a request or response body. Provided an implementation of this interface to ExchangeContext in order to substitute a request or response body.
public interface IStreamSubstitution
Methods
Substitute(Stream)
This class is used to low level-mock request and response body. Even if this class is async for fast mocking purpose, calling async in the implementation will lead to unnecessary overhead. Additionally, you must drain (read to EOF) the provided stream in order to not hang the remote connection when the original stream is coming from a remote connection.
ValueTask<Stream> Substitute(Stream originalStream)
Parameters
originalStream
StreamThe original stream (must be drained and disposed)