Class ProtoHttpExchange

Namespace
ProtoTest.Http
Assembly
ProtoTest.Http.dll

The send-and-read mechanics every HTTP-based protocol shares: send with response headers read, cap the buffered body through ProtoHttpResponseBuffer, then read it as text and bytes. A failure while reading disposes the response, so a caller cannot leak one by forgetting a finally block; on success the caller owns Response.

public static class ProtoHttpExchange
Inheritance
ProtoHttpExchange
Inherited Members

Methods

SendAsync(HttpClient, HttpRequestMessage, int, CancellationToken)

Sends a request and reads its complete body under the protocol's byte cap.

public static ValueTask<ProtoHttpExchangeResult> SendAsync(HttpClient client, HttpRequestMessage request, int maxResponseBodyBytes, CancellationToken cancellationToken = default)

Parameters

client HttpClient
request HttpRequestMessage
maxResponseBodyBytes int
cancellationToken CancellationToken

Returns

ValueTask<ProtoHttpExchangeResult>