IdempotencyOptionsType
Esta página aún no está disponible en tu idioma.
IdempotencyOptionsType =
object
Defined in: src/http/cache/IdempotencyOptions.ts:13
Plain options-object shape accepted by idempotent.
Properties
Section titled “Properties”
readonlycache:Cache
Defined in: src/http/cache/IdempotencyOptions.ts:14
headerName?
Section titled “headerName?”
readonlyoptionalheaderName?:string
Defined in: src/http/cache/IdempotencyOptions.ts:22
Header to read the idempotency key from. Default: 'idempotency-key'
(the standard). Header names are matched case-insensitively against
the request.headers map (which holds them lower-cased).
identity?
Section titled “identity?”
readonlyoptionalidentity?: (request) =>string|Promise<string>
Defined in: src/http/cache/IdempotencyOptions.ts:44
Derive a per-caller scope folded into the cache key so a cached response
is NEVER replayed to a different caller (security audit HTTP-4).
Without it, two callers sending the same method + path + body under the
same Idempotency-Key share one cache entry — fine for a public
endpoint, unsafe when the response is identity-specific (the second
caller would get the first caller’s data / Set-Cookie). Return the
authenticated principal (user / tenant / API-key id), e.g.
identity: (request) => request.headers['x-account-id'] ?? 'anon'.
Parameters
Section titled “Parameters”request
Section titled “request”Returns
Section titled “Returns”string | Promise<string>
keyPrefix?
Section titled “keyPrefix?”
readonlyoptionalkeyPrefix?:string
Defined in: src/http/cache/IdempotencyOptions.ts:26
Cache-key namespace. Default: 'idem:'.
missingHeader?
Section titled “missingHeader?”
readonlyoptionalmissingHeader?:"reject"|"pass-through"
Defined in: src/http/cache/IdempotencyOptions.ts:33
What to do when the request lacks the header. Default: 'reject'
(respond 400). Setting 'pass-through' runs the handler unchanged
— useful when only some clients use idempotency and you don’t want
to break the others.
ttlMs?
Section titled “ttlMs?”
readonlyoptionalttlMs?:number
Defined in: src/http/cache/IdempotencyOptions.ts:16
How long to remember responses. Default: 24 hours.
