Skip to content

Commit a16bf98

Browse files
committed
Added comment and improved code
1 parent 72d6de1 commit a16bf98

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/datadog-instrumentations/src/cookie-parser.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ addHook({
2525
name: 'cookie-parser',
2626
versions: ['>=1.0.0']
2727
}, cookieParser => {
28+
// This prevents the non default export from entering the wrapping process
2829
if (cookieParser.default) return cookieParser
2930
return shimmer.wrapFunction(cookieParser, cookieParser => function () {
3031
const cookieMiddleware = cookieParser.apply(this, arguments)

packages/datadog-plugin-cookie-parser/test/integration-test/client.spec.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ withVersions('cookie-parser', 'cookie-parser', version => {
1515
this.timeout(50000)
1616
sandbox = await createSandbox([`'cookie-parser@${version}'`, 'express'], false,
1717
['./packages/datadog-plugin-cookie-parser/test/integration-test/*'])
18-
variants = varySandbox(sandbox, 'server.mjs', 'cookie-parser', undefined, 'cookieParser')
18+
variants = varySandbox(sandbox, 'server.mjs', 'cookie-parser', 'cookieParser')
1919
})
2020

2121
after(async function () {
@@ -28,16 +28,15 @@ withVersions('cookie-parser', 'cookie-parser', version => {
2828
})
2929

3030
afterEach(async () => {
31-
proc && proc.kill()
31+
proc?.kill()
3232
await agent.stop()
3333
})
3434

3535
for (const variant of varySandbox.VARIANTS) {
3636
it(`is instrumented loaded with ${variant}`, async () => {
3737
proc = await spawnPluginIntegrationTestProc(sandbox.folder, variants[variant], agent.port)
3838
const response = await curl(proc)
39-
const counterValue = response.headers['x-counter']
40-
assert.equal(counterValue, '1')
39+
assert.equal(response.headers['x-counter'], '1')
4140
})
4241
}
4342
})

0 commit comments

Comments
 (0)