Parse a Retry-After header into a delay in milliseconds (RFC 9110 §10.2.3):
either delay-seconds ("120") or an HTTP-date ("Wed, 21 Oct 2026 07:28:00 GMT",
turned into the time left from now; a date in the past gives 0).
Returns undefined when the header is absent or malformed — negative ("-5"),
fractional ("1.5"), any other date format — so the caller falls back to linear
backoff. The strict patterns matter: Date.parse alone reads "1.5", "-5" and
"0.5" as dates in 2000/2001 and so retried at once, in a burst.
Parse a
Retry-Afterheader into a delay in milliseconds (RFC 9110 §10.2.3): either delay-seconds ("120") or an HTTP-date ("Wed, 21 Oct 2026 07:28:00 GMT", turned into the time left fromnow; a date in the past gives 0).Returns
undefinedwhen the header is absent or malformed — negative ("-5"), fractional ("1.5"), any other date format — so the caller falls back to linear backoff. The strict patterns matter:Date.parsealone reads"1.5","-5"and"0.5"as dates in 2000/2001 and so retried at once, in a burst.