Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ab-test-middleware

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ab-test-middleware - npm Package Compare versions

Comparing version 0.1.6-alpha to 0.1.7-alpha

modules/lib/fileExists.js

8

modules/middleware/DefaultDistributionMiddleware.js
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);

9

modules/middleware/DistributionMiddleware.js
/* 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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc