httpCorrelation
httpCorrelation(
options?):HttpMiddleware
Defined in: middlewares/http-correlation.middleware.ts:43
An HTTP middleware that takes the correlation id from the incoming request header and runs the rest of the request with it (runWithCorrelationId), so pipelines that the request starts take it. It echoes the id on the response header.
The header name defaults to x-correlation-id. If header is omitted or is any
non-string value (including false), the default header is used.
An incoming id longer than 128 characters or outside the default character set is
replaced by a local id. acceptIncoming, trimIncoming, maxLength and
validateIncoming adjust that policy.
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”Throws
Section titled “Throws”TypeError when header is not a valid HTTP field name, or maxLength is not
a positive safe integer.
Example
Section titled “Example”Express
app.use(httpCorrelation({ trimIncoming: true, validateIncoming: (id) => id.startsWith('edge:') }));