http-client
http-client copied to clipboard
Allow Retries for Write Operations
The allowRetries
option currently only applies OPTIONS
, GET
, DELETE
and HEAD
(see RetryableHttpVerbs
since those operations are idempotent by default. This is a good default and avoids any unintended side effects.
There should be an option for the client to specify allowing retries for specific write operations (PUT
and POST
) if the client knows they are idempotent.
@joshmgross - since this is so specific to the caller, scenario, and potentially a dangerous thing to do, I think it's best for the consumer to do the retries. Either that or the option is allow unsafeWriteRetries? (sort of how a compiler makes unsafe optional stuff clear). Thoughts?
I think an unsafeWriteRetries
option would work, as it clarifies that it's potentially dangerous.
Making the consumer implement their own retries is fine, but ends up just duplicating code that's already contained in this package and could potentially introduce issues if not implemented correctly.