Μετάβαση στο περιεχόμενο

httpCorrelation

Αυτό το περιεχόμενο δεν είναι ακόμη διαθέσιμο στη γλώσσα σου.

httpCorrelation(options?): HttpMiddleware

Defined in: middlewares/http-correlation.middleware.ts:40

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 that the rules configureCorrelation sets reject (by default, longer than 128 characters or outside the default character set) is replaced by a local id and reported to onRejected with the source 'http'. acceptIncoming, trimIncoming, maxLength and validateIncoming adjust that policy for this middleware. None of them lets through an id that is not printable ASCII or that starts or ends with a space.

CorrelationOptions

HttpMiddleware

TypeError when header is not a valid HTTP field name, or maxLength is not a positive safe integer.

Express

app.use(httpCorrelation({ trimIncoming: true, validateIncoming: (id) => id.startsWith('edge:') }));