"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.requestIdMiddleware = void 0;
const uuid_1 = require("uuid");
const REQUEST_ID_HEADER = 'x-request-id';
const requestIdMiddleware = (req, res, next) => {
    const requestId = req.headers[REQUEST_ID_HEADER] ?? (0, uuid_1.v4)();
    res.locals.requestId = requestId;
    res.setHeader(REQUEST_ID_HEADER, requestId);
    next();
};
exports.requestIdMiddleware = requestIdMiddleware;
//# sourceMappingURL=request-id.middleware.js.map