How to use the request.pathname function in request

To help you get started, we’ve selected a few request examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github brave / vault / src / index.js View on Github external
logger.forEach(function (entry) {
    if ((entry.data) && (typeof entry.data.msec === 'number')) { params.request.duration = entry.data.msec }
  })

  if ((newrelic) && (request.response._error)) {
    flattened = {}
    underscore.keys(params).forEach(param => {
      underscore.keys(params[param]).forEach(key => {
        if ((param === 'error') && ((key === 'message') || (key === 'payload') || (key === 'stack'))) return

        flattened[param + '.' + key] = params[param][key]
      })
    })
    flattened.url = flattened['request.pathname']
    delete flattened['request.pathname']
    newrelic.noticeError(request.response._error, flattened)
  }

  debug('end', { sdebug: params })
})
github brave / ledger / src / index.js View on Github external
logger.forEach((entry) => {
    if ((entry.data) && (typeof entry.data.msec === 'number')) { params.request.duration = entry.data.msec }
  })

  if ((newrelic) && (request.response._error)) {
    flattened = {}
    underscore.keys(params).forEach(param => {
      underscore.keys(params[param]).forEach(key => {
        if ((param === 'error') && ((key === 'message') || (key === 'payload') || (key === 'stack'))) return

        flattened[param + '.' + key] = params[param][key]
      })
    })
    flattened.url = flattened['request.pathname']
    delete flattened['request.pathname']
    newrelic.noticeError(request.response._error, flattened)
  }

  debug('end', { sdebug: params })
})
github brave / ledger / src / index.js View on Github external
}

  logger.forEach((entry) => {
    if ((entry.data) && (typeof entry.data.msec === 'number')) { params.request.duration = entry.data.msec }
  })

  if ((newrelic) && (request.response._error)) {
    flattened = {}
    underscore.keys(params).forEach(param => {
      underscore.keys(params[param]).forEach(key => {
        if ((param === 'error') && ((key === 'message') || (key === 'payload') || (key === 'stack'))) return

        flattened[param + '.' + key] = params[param][key]
      })
    })
    flattened.url = flattened['request.pathname']
    delete flattened['request.pathname']
    newrelic.noticeError(request.response._error, flattened)
  }

  debug('end', { sdebug: params })
})
github brave-intl / bat-ledger / bat-utils / lib / hapi-server.js View on Github external
})
    }

    logger.forEach((entry) => {
      if ((entry.data) && (typeof entry.data.msec === 'number')) { params.request.duration = entry.data.msec }
    })

    if ((runtime.newrelic) && (request.response._error)) {
      underscore.keys(params).forEach(param => {
        underscore.keys(params[param]).forEach(key => {
          if ((param === 'error') && ((key === 'message') || (key === 'payload') || (key === 'stack'))) return

          flattened[param + '.' + key] = params[param][key]
        })
      })
      flattened.url = flattened['request.pathname']
      delete flattened['request.pathname']
      runtime.newrelic.noticeError(request.response._error, flattened)
    }

    debug('end', { sdebug: params })
  })
github brave / vault / src / index.js View on Github external
logger.forEach((entry) => {
    if ((entry.data) && (typeof entry.data.msec === 'number')) { params.request.duration = entry.data.msec }
  })

  if ((newrelic) && (request.response._error)) {
    flattened = {}
    underscore.keys(params).forEach(param => {
      underscore.keys(params[param]).forEach(key => {
        if ((param === 'error') && ((key === 'message') || (key === 'payload') || (key === 'stack'))) return

        flattened[param + '.' + key] = params[param][key]
      })
    })
    flattened.url = flattened['request.pathname']
    delete flattened['request.pathname']
    newrelic.noticeError(request.response._error, flattened)
  }

  debug('end', { sdebug: params })
})
github brave-intl / bat-ledger / bat-utils / lib / hapi-server.js View on Github external
}

    logger.forEach((entry) => {
      if ((entry.data) && (typeof entry.data.msec === 'number')) { params.request.duration = entry.data.msec }
    })

    if ((runtime.newrelic) && (request.response._error)) {
      underscore.keys(params).forEach(param => {
        underscore.keys(params[param]).forEach(key => {
          if ((param === 'error') && ((key === 'message') || (key === 'payload') || (key === 'stack'))) return

          flattened[param + '.' + key] = params[param][key]
        })
      })
      flattened.url = flattened['request.pathname']
      delete flattened['request.pathname']
      runtime.newrelic.noticeError(request.response._error, flattened)
    }

    debug('end', { sdebug: params })
  })
github brave / vault / src / index.js View on Github external
}

  logger.forEach((entry) => {
    if ((entry.data) && (typeof entry.data.msec === 'number')) { params.request.duration = entry.data.msec }
  })

  if ((newrelic) && (request.response._error)) {
    flattened = {}
    underscore.keys(params).forEach(param => {
      underscore.keys(params[param]).forEach(key => {
        if ((param === 'error') && ((key === 'message') || (key === 'payload') || (key === 'stack'))) return

        flattened[param + '.' + key] = params[param][key]
      })
    })
    flattened.url = flattened['request.pathname']
    delete flattened['request.pathname']
    newrelic.noticeError(request.response._error, flattened)
  }

  debug('end', { sdebug: params })
})
github brave / vault / src / index.js View on Github external
}

  logger.forEach(function (entry) {
    if ((entry.data) && (typeof entry.data.msec === 'number')) { params.request.duration = entry.data.msec }
  })

  if ((newrelic) && (request.response._error)) {
    flattened = {}
    underscore.keys(params).forEach(param => {
      underscore.keys(params[param]).forEach(key => {
        if ((param === 'error') && ((key === 'message') || (key === 'payload') || (key === 'stack'))) return

        flattened[param + '.' + key] = params[param][key]
      })
    })
    flattened.url = flattened['request.pathname']
    delete flattened['request.pathname']
    newrelic.noticeError(request.response._error, flattened)
  }

  debug('end', { sdebug: params })
})