HttpRequestMessagePropertyKeys Class
- Namespace
- Kampute.HttpClient
- Assembly
- Kampute.HttpClient.dll
Definition
Provides the keys of the request properties that HttpRestClient sets and reads.
public static class HttpRequestMessagePropertyKeys- Inheritance
- object
- HttpRequestMessagePropertyKeys
Remarks
Examples
if (request.Options.TryGetValue(new HttpRequestOptionsKey<Guid>(HttpRequestMessagePropertyKeys.TransactionId), out var transactionId))
Console.WriteLine($"Transaction {transactionId}");Fields
ErrorHandler
The key of the property that holds the IHttpErrorHandler that decided to retry the request after an error response.
public const string ErrorHandler = "HttpRestClient.ErrorHandler"Field Value
Remarks
The value of this property is of type IHttpErrorHandler.
ResponseObjectType
The key of the property that holds the type into which the response is read.
public const string ResponseObjectType = "HttpRestClient.ResponseObjectType"Field Value
Remarks
The value of this property is of type Type.
SkipUnauthorizedHandling
The key of the property that, when
true, stops HttpError401Handler from handling a '401 Unauthorized' response to the request.public const string SkipUnauthorizedHandling = "HttpRestClient.SkipUnauthorizedHandling"Field Value
Remarks
The value of this property is of type bool.
TransactionId
The key of the property that identifies a request and the copies made for its retries.
public const string TransactionId = "HttpRestClient.TransactionId"Field Value
Remarks
The value of this property is of type Guid.

On .NET 5 and later, read these properties through
HttpRequestMessage.Optionswith anHttpRequestOptionsKey<TValue>named after the key, becauseHttpRequestMessage.Propertiesis obsolete there. Both show the same values. On .NET Framework, read them throughHttpRequestMessage.Properties.