strapi-plugin-request-id
Version:
Add a unique id to each request made to your server and track your users' activity in the logs.
20 lines (18 loc) • 451 B
JavaScript
;
module.exports = {
default: {
/**
* Define the header to use to get/set the correlation id.
*/
correlationIdHeader: "X-Correlation-Id",
},
validator: ({ correlationIdHeader } = {}) => {
if (
typeof correlationIdHeader !== "string" ||
!correlationIdHeader ||
/^\s*$/.test(correlationIdHeader)
) {
throw new Error("correlationIdHeader has to be a non empty string.");
}
},
};