Parse a Retry-After header into a delay in milliseconds, supporting both
the delta-seconds form (Retry-After: 120) and the HTTP-date form
(Retry-After: Wed, 21 Oct 2025 07:28:00 GMT). Returns undefined when the
header is absent or unparseable so the caller can fall back to its own backoff.
The result is clamped to MAX_RETRY_AFTER_MS: the value is server-controlled
and the sleep is not bounded by timeoutMs, so an unclamped Retry-After
(huge delta-seconds or a far-future date) would let a hostile/misconfigured
endpoint stall the process indefinitely.
Parse a
Retry-Afterheader into a delay in milliseconds, supporting both the delta-seconds form (Retry-After: 120) and the HTTP-date form (Retry-After: Wed, 21 Oct 2025 07:28:00 GMT). Returnsundefinedwhen the header is absent or unparseable so the caller can fall back to its own backoff.The result is clamped to
MAX_RETRY_AFTER_MS: the value is server-controlled and the sleep is not bounded bytimeoutMs, so an unclampedRetry-After(huge delta-seconds or a far-future date) would let a hostile/misconfigured endpoint stall the process indefinitely.