HttpRequestMessageCloneManager Struct
- Namespace
- Kampute.HttpClient
- Assembly
- Kampute.HttpClient.dll
Definition
Manages clones of HttpRequestMessage for retry operations.
public struct HttpRequestMessageCloneManager : IDisposable- Inheritance
- Implements
Remarks
This class oversees the life-cycle of cloned HttpRequestMessage instances. It ensures that clones are properly managed and disposed of, preventing resource leaks and maintaining the integrity of the original HttpRequestMessage.
Constructors
HttpRequestMessageCloneManager(HttpRequestMessage)
Initializes a new instance of the HttpRequestMessageCloneManager struct with the specified HTTP request.
public HttpRequestMessageCloneManager(HttpRequestMessage request)Parameters
requestHttpRequestMessage- The original HttpRequestMessage to send.
Exceptions
- ArgumentNullException
- Thrown if
requestisnull.
Properties
RequestToSend
Gets the current HttpRequestMessage to send. This request may be the original or a new request based on retry decisions.
public readonly HttpRequestMessage RequestToSend { get; }Property Value
- HttpRequestMessage
- The current HttpRequestMessage to send.
Methods
Dispose()
Disposes of any cloned requests, releasing the managed resources.
public readonly void Dispose()TryApplyDecision(in HttpErrorHandlerResult)
Attempts to apply a retry decision to the current request. If the decision includes a request to retry, updates the current request and disposes of the previous request if it is not the original.
public bool TryApplyDecision(in HttpErrorHandlerResult decision)Parameters
decisionHttpErrorHandlerResult- The retry decision.
