lib/request-extractors/hapi.js
function hapiRequestInformationExtractor(req) {

  var returnObject = new RequestInformationContainer();

  if (!isObject(req) || !isObject(req.headers) || isFunction(req) ||
      isArray(req)) {

    return returnObject;
  }

  returnObject.setMethod(req.method)
      .setUrl(req.url)
      .setUserAgent(req.headers['user-agent'])
      .setReferrer(req.headers.referrer)
      .setStatusCode(attemptToExtractStatusCode(req))
      .setRemoteAddress(extractRemoteAddressFromRequest(req));

  return returnObject;
}
function hapiRequestInformationExtractor(req) {

  var returnObject = new RequestInformationContainer();

  if (!isObject(req) || !isObject(req.headers) || isFunction(req) ||
      isArray(req)) {

    return returnObject;
  }

  returnObject.setMethod(req.method)
      .setUrl(req.url)
      .setUserAgent(req.headers['user-agent'])
      .setReferrer(req.headers.referrer)
      .setStatusCode(attemptToExtractStatusCode(req))
      .setRemoteAddress(extractRemoteAddressFromRequest(req));

  return returnObject;
}
function hapiRequestInformationExtractor ( req ) { var returnObject = new RequestInformationContainer ( ) ; if ( ! isObject ( req ) || ! isObject ( req . headers ) || isFunction ( req ) || isArray ( req ) ) { return returnObject ; } returnObject . setMethod ( req . method ) . setUrl ( req . url ) . setUserAgent ( req . headers [ 'user-agent' ] ) . setReferrer ( req . headers . referrer ) . setStatusCode ( attemptToExtractStatusCode ( req ) ) . setRemoteAddress ( extractRemoteAddressFromRequest ( req ) ) ; return returnObject ; }
This function is used to extract request information from a hapi request
object. This function will not check for the presence of properties on the
request object.
@function hapiRequestInformationExtractor
@param {Object} req - the hapi request object to extract from
@returns {RequestInformationContainer} - an object containing the request
information in a standardized format
This function is used to extract request information from a hapi request object . This function will not check for the presence of properties on the request object .