Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pino-std-serializers

Package Overview
Dependencies
Maintainers
4
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pino-std-serializers - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

4

lib/req.js

@@ -56,5 +56,5 @@ 'use strict'

function reqSerializer (req) {
var connection = req.connection
// req.info is for hapi compat.
var connection = req.info || req.connection
const _req = Object.create(pinoReqProto)
// req.info is for hapi compat.
_req.id = (typeof req.id === 'function' ? req.id() : (req.id || (req.info ? req.info.id : undefined)))

@@ -61,0 +61,0 @@ _req.method = req.method

{
"name": "pino-std-serializers",
"version": "2.0.0",
"version": "2.1.0",
"description": "A collection of standard object serializers for Pino",

@@ -34,4 +34,4 @@ "main": "index.js",

"standard": "^11.0.0",
"tap": "^11.1.1"
"tap": "^12.0.0"
}
}

@@ -204,1 +204,77 @@ 'use strict'

})
test('req.remoteAddress will be obtained from request connect.remoteAddress as fallback', function (t) {
t.plan(1)
var server = http.createServer(handler)
server.unref()
server.listen(0, () => {
http.get(server.address(), () => {})
})
t.tearDown(() => server.close())
function handler (req, res) {
req.connection = {remoteAddress: 'http://localhost'}
var serialized = serializers.reqSerializer(req)
t.is(serialized.remoteAddress, 'http://localhost')
res.end()
}
})
test('req.remoteAddress will be obtained from request info.remoteAddress if available', function (t) {
t.plan(1)
var server = http.createServer(handler)
server.unref()
server.listen(0, () => {
http.get(server.address(), () => {})
})
t.tearDown(() => server.close())
function handler (req, res) {
req.info = {remoteAddress: 'http://localhost'}
var serialized = serializers.reqSerializer(req)
t.is(serialized.remoteAddress, 'http://localhost')
res.end()
}
})
test('req.remotePort will be obtained from request connect.remotePort as fallback', function (t) {
t.plan(1)
var server = http.createServer(handler)
server.unref()
server.listen(0, () => {
http.get(server.address(), () => {})
})
t.tearDown(() => server.close())
function handler (req, res) {
req.connection = {remotePort: 3000}
var serialized = serializers.reqSerializer(req)
t.is(serialized.remotePort, 3000)
res.end()
}
})
test('req.remotePort will be obtained from request info.remotePort if available', function (t) {
t.plan(1)
var server = http.createServer(handler)
server.unref()
server.listen(0, () => {
http.get(server.address(), () => {})
})
t.tearDown(() => server.close())
function handler (req, res) {
req.info = {remotePort: 3000}
var serialized = serializers.reqSerializer(req)
t.is(serialized.remotePort, 3000)
res.end()
}
})

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc