Skip to Content
Senri

Request ID

Give each request an ID with requestId()

import { , , type  } from "@senrijs/senri";

const  = <>();

.(());
.("/", (, ) => `id: ${.("requestId")}`);
  • It makes an ID for each request and puts it in c.get("requestId") and the response's X-Request-Id
  • Use it to find the same request in logs and traces

Use the incoming ID

An incoming X-Request-Id is not used by default (anyone can send one). Behind a trusted proxy, set trustIncoming: true.

.(({ : true }));

Only values of up to 128 characters of A-Z a-z 0-9 . _ = + / - are accepted. Anything else is replaced with a new ID.

Options

Prop

Type

On this page