UNPKG

tezx

Version:

TezX is a modern, ultra-lightweight, and high-performance JavaScript framework built specifically for Bun. It provides a minimal yet powerful API, seamless environment management, and a high-concurrency HTTP engine for building fast, scalable web applicat

15 lines (14 loc) 569 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.requestID = exports.default = void 0; const index_js_1 = require("../helper/index.js"); const requestID = (headerName = "X-Request-ID", contextKey = "requestID") => { return function requestID(ctx, next) { let requestId = ctx.headers.get(headerName) ?? `req-${(0, index_js_1.generateUUID)()}`; ctx[contextKey] = requestId; ctx.headers.set(headerName, requestId); return next(); }; }; exports.default = requestID; exports.requestID = requestID;