ab-test-middleware
Advanced tools
Comparing version 0.1.6-alpha to 0.1.7-alpha
const path = require('path'); | ||
const express = require('express'); | ||
const fileExists = require("../lib/fileExists"); | ||
@@ -12,3 +13,8 @@ const defaultDistributionMiddleware = (req, res, next) => { | ||
} | ||
return res.sendFile(path.join(defaultDist, modifiedBaseUrl), { root: distPath, index: false }); | ||
const filePath = path.join(defaultDist, modifiedBaseUrl); | ||
if (fileExists(`${distPath}/${filePath}`)) { | ||
return res.sendFile(path.join(defaultDist, modifiedBaseUrl), { root: distPath, index: false }); | ||
} else { | ||
next(); | ||
} | ||
} catch (e) { | ||
@@ -15,0 +21,0 @@ return next(e); |
/* eslint-disable no-param-reassign */ | ||
const path = require('path'); | ||
const express = require('express'); | ||
const fileExists = require("../lib/fileExists"); | ||
@@ -29,4 +30,8 @@ let entryFile; | ||
} | ||
return res.sendFile(path.join(dist, req.locals.modifiedBaseUrl), { root: distPath, index: false }); | ||
const filePath = path.join(dist, req.locals.modifiedBaseUrl); | ||
if (fileExists(`${distPath}/${filePath}`)) { | ||
return res.sendFile(filePath, { root: distPath, index: false }); | ||
} else { | ||
next(); | ||
} | ||
} | ||
@@ -33,0 +38,0 @@ } catch (e) { |
{ | ||
"name": "ab-test-middleware", | ||
"version": "0.1.6-alpha", | ||
"version": "0.1.7-alpha", | ||
"description": "An express middleware that manages multiple distributions for A/B/N testing purposes.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15411
12
306
2