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 ("-1"),
fractional ("1.5"), padded inside, any other date format — so the caller falls
back to its own backoff. The strict patterns matter: Date.parse alone would
read "1.5" as a date in 2001 and retry at once.
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 ("-1"), fractional ("1.5"), padded inside, any other date format — so the caller falls back to its own backoff. The strict patterns matter:Date.parsealone would read"1.5"as a date in 2001 and retry at once.