Skip to content

Commit

Permalink
hapi 17 support comments
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmarkclements committed Mar 28, 2018
1 parent 725d0ae commit 63876ff
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/req.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,15 @@ Object.defineProperty(pinoReqProto, rawSymbol, {
function reqSerializer (req) {
var connection = 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))) || ''
_req.method = req.method
_req.url = req.url.path || req.url
// req.url.path is for hapi compat.
_req.url = req.url ? (req.url.path || req.url) : undefined
_req.headers = req.headers
_req.remoteAddress = connection && connection.remoteAddress
_req.remotePort = connection && connection.remotePort
// req.raw is for hapi compat/equivalence
_req.raw = req.raw || req
return _req
}
Expand Down

0 comments on commit 63876ff

Please sign in to comment.