Intercepted values are preserved from previous request on retry #2376
Labels
documentation
Issues that require updates to our documentation
feedback provided
Feedback has been provided to the author
I'm using feign to call a backend API that needs a checksum of the request body as a query parameter. For this purpose I've implemented a RequestInterceptor which applies that query parameter to the request. Due to some issues with that API (f. ex. it being down for a few seconds) I also have a retrier applied, that retries the request in case it fails.
I just noticed an issue with that setup: the checkstum query parameter set in the previous request (that failed and should get retried) is not removed and the request is applied to the same request interceptor again. Due to the issue that there is no way to set a query parameter (only to append) which isn't clear from the method naming (
query
&appendQuery
while both append to the query) the checksum is applied multiple times, causing the request to fail again as the backend (for some reason, don't ask me why) cannot handle multiple checksum parameters provided in the request:<backend url>?checksum=1da6e6d858608e64d5e4a9798c589833&checksum=1da6e6d858608e64d5e4a9798c589833&checksum=1da6e6d858608e64d5e4a9798c589833&checksum=1da6e6d858608e64d5e4a9798c589833&checksum=1da6e6d858608e64d5e4a9798c589833&checksum=1da6e6d858608e64d5e4a9798c589833
For now I will just go ahead and remove the previous query parameter (calling
query("checksum", List.of())
), but it would be nice if the old request without the intercepted values could be passed to the retrier to prevent these issues (not calling the interceptors again might be another solution, however, maybe there are apis that need f. ex. a time-based checksum that requires re-computing the checksum). Another solution might be to just addsetQuery
/setHeader
methods to override the previous query/header value explicitly.I didn't validate yet, but I am pretty sure that issue also applies to headers.
The text was updated successfully, but these errors were encountered: