firefly-limiter - v1.0.1
    Preparing search index...

    Interface TransportOptions

    Configuration for transport.

    interface TransportOptions {
        bodySize?: (request: Request) => number | undefined;
        clock?: Clock;
        maxReplayBytes?: number;
        maxRetryAfter?: number;
        onEvent?: EventSink;
        retryStatuses?: Iterable<number, any, any>;
        retryUnsafeMethods?: boolean;
    }
    Index
    bodySize?: (request: Request) => number | undefined

    How long a request's body is, when that is known before reading it.

    Defaults to reading content-length, which survives on a Request under Node but is a forbidden header in a browser, so it is a hint rather than an answer: a body that declares nothing is still read against maxReplayBytes, and one that declares a lie is still measured. What the hint buys is not reading two gigabytes to discover that two gigabytes is too much.

    clock?: Clock

    Defaults to the system clock.

    maxReplayBytes?: number

    How much of a request body may be held in memory so the request can be sent again. Defaults to one mebibyte.

    Replaying a body means keeping it, and a stream gives no way to ask how long it is. So a body is read up to this ceiling: under it, every attempt is sent from the same bytes; over it, the request is sent once, whole, and never repeated. An upload cannot quietly become the process's memory problem, and it cannot be truncated either.

    A request that declares its own length is not read at all when the declaration is already over the ceiling. See bodySize.

    maxRetryAfter?: number

    Ceiling on a Retry-After wait, in milliseconds. Defaults to 30 seconds.

    Set it to the same figure as the schedule's max. Without a ceiling, a mistaken or hostile header can park a request for an hour.

    onEvent?: EventSink

    Receives the decisions this transport makes on its own: currently a body-too-large, which is the only thing here that quietly changes whether a request can be repeated.

    retryStatuses?: Iterable<number, any, any>

    Statuses treated as retryable. Defaults to retryableStatuses.

    retryUnsafeMethods?: boolean

    Sends POST and PATCH again as well.

    Whether repeating one is safe is the question the transport cannot answer: it can see the method and an Idempotency-Key, and you know the rest. A request carrying that header is retried without this option.