HTTP Client does not retry all types of requests #1710
Labels
bug
Indicates an unexpected problem or unintended behavior
smartbear-supported
SmartBear engineering team will support this issue. See https://docs.pact.io/help/smartbear
When the broker errors with a 5xx status code the HTTP client should attempt, up to a configurable limit, to retry the request.
We currently use the
DefaultHttpRequestRetryStrategy
here: https://github.com/pact-foundation/pact-jvm/blob/2b2055f0d9e0d10c2bfe51898d7163e037a772d9/core/support/src/main/kotlin/au/com/dius/pact/core/support/HttpClient.kt#L89C49-L89C49, however this strategy ignores potentially non-idempotent requests. So allPOST
,PUT
,DELETE
etc. will not be retried.This includes local verification which takes a body for the "pacts for verification" endpoint.
From the docs on that class: https://hc.apache.org/httpcomponents-client-4.5.x/current/tutorial/html/fundamentals.html#d5e293
The Pact Broker assumes retries because it's designed for CI/CD systems where builds can be re-run multiple times, so it is safe to retry all requests.
Discovered via this slack conversation: https://pact-foundation.slack.com/archives/CLS16AVEE/p1692695354797019.
The text was updated successfully, but these errors were encountered: