index.js
function reqToJSON (req, additional) {
  additional = additional || []
  if (additional === true) {
    additional = [
      'rawHeaders',
      'rawTrailers',
      // express/koa
      'fresh',
      'cookies',
      'ip',
      'ips',
      'stale',
      'subdomains'
    ]
  }
  var keys = [
    'body',
    'headers',
    'httpVersion',
    'method',
    'trailers',
    'url',
    'socket.remoteAddress',
    // express/koa
    'originalUrl',
    'params',
    'query'

  ].concat(additional).sort()
  var json = pick(req, keys)
  defaults(json, getParsedUrl(req))
  return json
}
function reqToJSON (req, additional) {
  additional = additional || []
  if (additional === true) {
    additional = [
      'rawHeaders',
      'rawTrailers',
      // express/koa
      'fresh',
      'cookies',
      'ip',
      'ips',
      'stale',
      'subdomains'
    ]
  }
  var keys = [
    'body',
    'headers',
    'httpVersion',
    'method',
    'trailers',
    'url',
    'socket.remoteAddress',
    // express/koa
    'originalUrl',
    'params',
    'query'

  ].concat(additional).sort()
  var json = pick(req, keys)
  defaults(json, getParsedUrl(req))
  return json
}
function reqToJSON ( req , additional ) { additional = additional || [ ] if ( additional === true ) { additional = [ 'rawHeaders' , 'rawTrailers' , // express/koa 'fresh' , 'cookies' , 'ip' , 'ips' , 'stale' , 'subdomains' ] } var keys = [ 'body' , 'headers' , 'httpVersion' , 'method' , 'trailers' , 'url' , 'socket.remoteAddress' , // express/koa 'originalUrl' , 'params' , 'query' ] . concat ( additional ) . sort ( ) var json = pick ( req , keys ) defaults ( json , getParsedUrl ( req ) ) return json }
return a json representation of a request
@param  {IncomingMessage} req request (client incoming-message or client-request)
@param  {Array} additional additional properties to pick from request
@return {Object} resJSON
return a json representation of a request