You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a common HttpClient that is used or sending multiple requests like GET, POST, PUT etc. I am trying to configure different retry behavior for GET versus POST/PUT calls. Basically I am trying to configure a timeout per retry behavior for GET calls and a transient error behavior for POST/PUT calls.
What code or approach do you have so far?
I defined following two policies. policy1 handles the result of GET requests and handles the TimeoutRejectedException
along with transient errors whereas policy2 handles transient errors for requests other than GET. I then wrap both policies.
However, with the policies configured like this, I see retries happening for both GET and POST requests. I think it's because of the timeout policy around the HttpClient. Not sure if it's possible to define on a single client like this.
Additional context
No response
The text was updated successfully, but these errors were encountered:
The AddPolicyHandler call registers a PolicyHttpMessageHandler which is a DelegatingHandler. I would suggest to combine all your policies into a single Policy.WrapAsync and register only a single DelegatingHandler instead of three.
What are you wanting to achieve?
I have a common
HttpClient
that is used or sending multiple requests like GET, POST, PUT etc. I am trying to configure different retry behavior for GET versus POST/PUT calls. Basically I am trying to configure a timeout per retry behavior for GET calls and a transient error behavior for POST/PUT calls.What code or approach do you have so far?
I defined following two policies.
policy1
handles the result of GET requests and handles theTimeoutRejectedException
along with transient errors whereas
policy2
handles transient errors for requests other than GET. I then wrap both policies.And then while registering the
HttpClient
I add the retry policy handlers as below:However, with the policies configured like this, I see retries happening for both GET and POST requests. I think it's because of the timeout policy around the HttpClient. Not sure if it's possible to define on a single client like this.
Additional context
No response
The text was updated successfully, but these errors were encountered: