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

On .NET 5 and later, read these properties through HttpRequestMessage.Options with an HttpRequestOptionsKey<TValue> named after the key, because HttpRequestMessage.Properties is obsolete there. Both show the same values. On .NET Framework, read them through HttpRequestMessage.Properties.

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

string

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

string

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

string

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

string

Remarks

The value of this property is of type Guid.