HttpClient does automatic retry after recieving 408 (Timeout) error code from server

Problem: When sending http request through httpclient to server, server intentionally returns 408 timeout error response and I want that response also. But what happens is, it is doing automatic retry after recieving this error code and send same request again after removing auth bearer token resulting in 401 (Unauthorized error). Note: I am not recieving 408 error response, recieving only 401 error response What I want: 1. Either it will not do retry again 2. or why it is removing authorization token when retrying (how I can add?) Findings: 1. 408 is transient error code and httpclient has default retry policy for that 2. Can break the circuit using Polly and custom handlers but not working as expected Can anyone help?
5 Replies
softwareEng
softwareEng2mo ago
you need to ensure that the retry logic is not applied in your HttpClient configuration and which retry policies , you are using
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
aquatic stone
aquatic stone2mo ago
I am not using any retry policies, I am making simple default httpclient object. Httpclient itself does automatic retry and I want to break it but not working as expected. It's simple httpclient object and nothing else other configurations.
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
exixt
exixt2mo ago
but, it's not, we need code to help you a "simple httpclient object" doesn't retry requests by default
Want results from more Discord servers?
Add your server