Struct HttpRequestMessageCloneManager
- Namespace
- Kampute.HttpClient
- Assembly
- Kampute.HttpClient.dll
Manages clones of HttpRequestMessage for retry operations.
public struct HttpRequestMessageCloneManager : IDisposable
- Implements
- Inherited Members
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
request
HttpRequestMessageThe original HttpRequestMessage to send.
Exceptions
- ArgumentNullException
Thrown if
request
is null.
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
decision
HttpErrorHandlerResultThe retry decision.