@openreply/emw-request-id
Advanced tools
Comparing version 1.0.0 to 1.0.1
## requestId([options]) | ||
## requestId(options) | ||
searches for a trace id in the request headers or otherwise creates one | ||
@@ -12,5 +12,5 @@ | ||
| --- | --- | --- | | ||
| [options] | RequestIdOptions | configuration options for this middleware | | ||
| options | RequestIdConfiguration | configuration options for this middleware | | ||
## RequestIdOptions : object | ||
## RequestIdConfiguration : object | ||
**Kind**: global typedef | ||
@@ -17,0 +17,0 @@ **Properties** |
@@ -13,3 +13,3 @@ /** | ||
/** | ||
* @typedef RequestIdOptions | ||
* @typedef RequestIdConfiguration | ||
* @type {object} | ||
@@ -29,3 +29,3 @@ * @property {string} serviceName - name of the service that will be appended to the trace id string | ||
* | ||
* @param {RequestIdOptions} [options] - configuration options for this middleware | ||
* @param {RequestIdConfiguration} options - configuration options for this middleware | ||
*/ | ||
@@ -47,4 +47,9 @@ function requestId(options) { | ||
// overwrite default values (if any) | ||
// eslint-disable-next-line no-param-reassign | ||
options = Object.assign({ | ||
const { | ||
serviceName, | ||
traceHeader, | ||
requestIdHeader, | ||
setResponseHeader, | ||
uuidGenerator | ||
} = Object.assign({ | ||
traceHeader: 'X-Amzn-Trace-Id', | ||
@@ -56,12 +61,5 @@ requestIdHeader: 'x-amzn-RequestId', | ||
const { | ||
serviceName, | ||
traceHeader, | ||
requestIdHeader, | ||
setResponseHeader, | ||
uuidGenerator | ||
} = options; | ||
// @param {object} req the express request object (see http://expressjs.com/en/4x/api.html#req) | ||
// @param {object} res the express response object (see http://expressjs.com/en/4x/api.html#res) | ||
// @param {object} next the next middleware object to be executed from the express stack | ||
// @param {object} req the express request object (see http://expressjs.com/en/4x/api.html#req) | ||
// @param {object} res the express response object (see http://expressjs.com/en/4x/api.html#res) | ||
// @param {object} next the next middleware object to be executed from the express stack | ||
return (req, res, next) => { | ||
@@ -68,0 +66,0 @@ // explicitly set the request id |
{ | ||
"name": "@openreply/emw-request-id", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "express middleware that manages request and trace ids", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -5,3 +5,3 @@ /* eslint-disable import/no-extraneous-dependencies, import/no-unresolved */ | ||
/* eslint-enable import/no-extraneous-dependencies, import/no-unresolved */ | ||
const requestId = require('../lib'); | ||
const requestId = require('..'); | ||
@@ -8,0 +8,0 @@ const app = express(); |
const { expect } = require('chai'); | ||
const sinon = require('sinon'); | ||
const requestId = require('../lib'); | ||
const requestId = require('..'); | ||
@@ -5,0 +5,0 @@ describe('emw-request-id', () => { |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1050019
814
1