UNPKG

@yhiot/utils

Version:
18 lines (17 loc) 766 B
/** * Return middleware that gets an unique request id from a header or * generates a new id. * * @param {Object} [options={}] - Optional configuration. * @param {string} [options.query] - Request query name to get the forwarded request id. * @param {string} [options.header=X-Request-Id] - Request header name to get the forwarded request id. * @param {string} [options.exposeHeader=X-Request-Id] - Response header name. * @param {function} [options.generator=uuidV4] - Id generator function. * @return {function} Koa middleware. */ export default function xRequestIdCreator(options?: { query?: string | undefined; header?: string | undefined; exposeHeader?: string | undefined; generator?: Function | undefined; } | undefined): Function;