Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function newRelicSwaggerMiddleware(req, res, next) {
let newrelic = require('newrelic'); // eslint-disable-line global-require
newrelic.setTransactionName(path.join(API_BASE_PATH, req.path));
next();
}
router.post('/featureImport/*', urlencodedParser, (req, res) => {
const { feature, params, auth } = req.body
const assetPrefix = getAssetPrefix(req)
const Locale = getLocale(params.languageTag)
nr.setTransactionName(`featureImport/${feature}`)
Raven.setContext({ user: auth, tags: { feature, url: params.url }, extra: { params } })
reactCookie.plugToRequest(req, res)
let verifiedAuth = null
checkAuth(auth).then(nr.createTracer('checkingAuth', (authResult) => {
const sessionData = Object.assign({}, authResult.userData)
authResult.userData.password = null
verifiedAuth = authResult
const defaultState = getDefaultState(feature)
let startingState = Object.assign({}, defaultState, { auth: verifiedAuth })
startingState = mapStateToParams(feature, startingState, params)
try {
const history = createMemoryHistory()