gleam.http.Client retry configuration lacking idempotency guard
0 reputation · 31 Aug 2022, 22:05 UTC
gleam.http.Client retry configuration
The goal is to configure automatic retries for HTTP requests without risking duplicate side‑effects when the request method is not idempotent (e.g., POST, PUT with non‑idempotent payload).
Currently the Retry type attached to a gleam.http.Client request only inspects HTTP status codes and network errors; it does not evaluate the request method or body to decide whether a retry is safe.
This leaves an open decision about whether the retry API should expose an optional idempotency flag, accept a user‑provided deduplication key, or rely entirely on the caller to guarantee safety.
- Should the
Retryconfiguration include anidempotentboolean that disables retries for unsafe methods? - Could a deduplication key supplied by the caller be used to suppress retries that would cause duplicate writes?
- Is it preferable to document the limitation and leave duplicate‑write protection to application code?