Skip to content

parseRetryAfterInMilliseconds

Reads an HTTP Retry-After header, which is either a number of seconds or an HTTP date.

Import:

import { parseRetryAfterInMilliseconds } from '@mnaoumov/typescript-dev-toolkit/docs-site/link-check';

Signature:

function parseRetryAfterInMilliseconds(headerValue: string | null, nowInMilliseconds: number): number | undefined

Parameters:

Parameter Type Description
headerValue string | null The header’s value, or null when the response has none.
nowInMilliseconds number The current time, against which a date is measured.

Returns: number | undefined — How long to wait, never negative, or undefined when the header is absent or unreadable.