Dibaca dalam bahasa Inggeris

Kongsi melalui


IHttpClientAsyncLogger.LogRequestStartAsync Method

Definition

Logs before sending an HTTP request.

public System.Threading.Tasks.ValueTask<object?> LogRequestStartAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken = default);

Parameters

request
HttpRequestMessage

The HTTP request message that will be sent.

cancellationToken
CancellationToken

The cancellation token to cancel operation.

Returns

The task object representing the asynchronous operation. The result of the operation is a context object that will be passed to a corresponding LogRequestStopAsync(Object, HttpRequestMessage, HttpResponseMessage, TimeSpan, CancellationToken) or LogRequestFailedAsync(Object, HttpRequestMessage, HttpResponseMessage, Exception, TimeSpan, CancellationToken). Can be null if no context object is needed by the implementation.

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

Applies to

Produk Versi
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)