AniLink - v3.0.0
    Preparing search index...

    Function parseRetryAfter

    • Parses a Retry-After header into the delay to wait, in milliseconds.

      Both documented formats are supported: delay-seconds ("120") and HTTP-date (resolved against now, which is injectable for tests). The result is clamped to [0, MAX_RETRY_AFTER_MS] so a hostile value cannot park a caller indefinitely; absent, empty, and unparseable headers return null so the caller falls back to client-chosen backoff.

      Parameters

      • header: string | undefined

        The raw Retry-After header value, when present.

      • now: number

        The current time in milliseconds, for HTTP-date values.

      Returns number | null

      The clamped delay in milliseconds, or null when the header is absent or unparseable.