Skip to content

Commit

Permalink
test(http): use alternative names to req and res
Browse files Browse the repository at this point in the history
  • Loading branch information
gerardo-lima-moonfare committed Nov 9, 2024
1 parent f01ca88 commit f705b9c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lib/symbols.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ module.exports = {
formatOptsSym,
messageKeySym,
errorKeySym,
responseKeySym,
requestKeySym,
nestedKeySym,
wildcardFirstSym,
needsMetadataGsym,
Expand All @@ -72,7 +74,5 @@ module.exports = {
hooksSym,
nestedKeyStrSym,
mixinMergeStrategySym,
msgPrefixSym,
responseKeySym,
requestKeySym,
msgPrefixSym
}
12 changes: 6 additions & 6 deletions test/http.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ test('http request support', async ({ ok, same, error, teardown }) => {
test('http request support via serializer', async ({ error, match }) => {
let originalReq
const instance = pino({
requestKey: 'myRequest',
serializers: {
req: (req) => req.arbitraryProperty,
}
Expand All @@ -56,7 +57,7 @@ test('http request support via serializer', async ({ error, match }) => {
hostname,
level: 30,
msg: 'my request',
req: originalReq.arbitraryProperty,
myRequest: originalReq.arbitraryProperty,
})
}))

Expand All @@ -70,7 +71,6 @@ test('http request support via serializer', async ({ error, match }) => {
server.unref()
server.listen()
const err = await once(server, 'listening')
error(err)

const res = await once(http.get('http://localhost:' + server.address().port), 'response')
res.resume()
Expand Down Expand Up @@ -157,16 +157,17 @@ test('http response support', async ({ ok, same, error, teardown }) => {
test('http response support via a serializer', async ({ match, error }) => {
let originalRes
const instance = pino({
responseKey: 'myResponse',
serializers: {
res: (res) => res.arbitraryProperty,
}
}, sink((chunk, enc) => {
}, sink((chunk, _enc) => {
match(chunk, {
pid,
hostname,
level: 30,
msg: 'my response',
res: originalRes.arbitraryProperty,
myResponse: originalRes.arbitraryProperty,
})
}))

Expand Down Expand Up @@ -196,7 +197,7 @@ test('http request support via serializer in a child', async ({ ok, same, error,
serializers: {
req: pino.stdSerializers.req
}
}, sink((chunk, enc) => {
}, sink((chunk, _enc) => {
ok(new Date(chunk.time) <= new Date(), 'time is greater than Date.now()')
delete chunk.time
same(chunk, {
Expand Down Expand Up @@ -224,7 +225,6 @@ test('http request support via serializer in a child', async ({ ok, same, error,
server.unref()
server.listen()
const err = await once(server, 'listening')
error(err)

const res = await once(http.get('http://localhost:' + server.address().port), 'response')
res.resume()
Expand Down

0 comments on commit f705b9c

Please sign in to comment.