mirror of
https://github.com/kubernetes/client-go.git
synced 2026-01-15 22:48:42 +00:00
This commit refactors the retry logic to include resetting the request body. The reset logic will be called iff it is not the first attempt. This refactor is nescessary mainly because now as per the retry logic, we always ensure that the request body is reset *after* the response body is *fully* read and closed in order to reuse the same TCP connection. Previously, the reset of the request body and the call to read and close the response body were not in the right order, which leads to race conditions. This commit also adds a test that verifies the order in which the function calls are made to ensure that we seek only after the response body is closed. Co-authored-by: Madhav Jivrajani <madhav.jiv@gmail.com> Kubernetes-commit: 68c8c458ee8f6629eef806c48c1a776dedad3ec4