Przejdź do głównej zawartości

Function: parseRetryAfterMs()

parseRetryAfterMs(headerValue): number | undefined

Parse a Retry-After header into milliseconds. Per RFC 9110 the value is either a delay in whole seconds or an HTTP-date; both forms are accepted. Returns undefined for an absent, unparsable, or already-elapsed value — callers treat that as "the server gave no instruction" and fall back to their own backoff.

Shared by the transport (non-JSON edge block pages) and the error middleware (HTTP errors) so a rate-limit instruction is read identically wherever it arrives.

Parameters

headerValue

string | null | undefined

Returns

number | undefined