New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-ab-decider

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-ab-decider - npm Package Compare versions

Comparing version 0.0.14 to 0.0.15

yarn.lock

23

index.js

@@ -38,5 +38,9 @@ const proxy = require("express-http-proxy");

const resolveProxyOptions = (selectedExperiment, middlewareOptions) => {
const { sendHeaderToChild = true, https = false } = middlewareOptions;
const {
sendHeaderToChild = true,
https = false,
headers = null
} = middlewareOptions;
const options = {
const proxyOptions = {
https

@@ -46,3 +50,3 @@ };

if (sendHeaderToChild) {
options["proxyReqOptDecorator"] = function(proxyReqOpts) {
proxyOptions["proxyReqOptDecorator"] = function (proxyReqOpts) {
proxyReqOpts.headers["ab-decider-child"] = "true";

@@ -52,4 +56,13 @@ return proxyReqOpts;

}
if (headers) {
proxyOptions["userResHeaderDecorator"] = function (originHeaders) {
return {
...originHeaders,
...headers
}
};
}
return options;
return proxyOptions;
};

@@ -65,3 +78,3 @@

skip = false,
hash = "nohash"
hash = "nohash"
} = opts;

@@ -68,0 +81,0 @@

{
"name": "node-ab-decider",
"version": "0.0.14",
"version": "0.0.15",
"description": "",

@@ -11,3 +11,4 @@ "main": "index.js",

"express-http-proxy": "^1.5.0",
"lodash": "^4.17.11"
"lodash": "^4.17.11",
"nocache": "^2.0.0"
},

@@ -14,0 +15,0 @@ "devDependencies": {

@@ -74,10 +74,9 @@ ## Setup

### avoidDefault
if true it force to choose an option between the experiments,
event if they doesn´t sum 100
### sendHeaderToChild
If false it avoids to send "ab-decider-child" header to the proxied endpoint
### encodeCookie
Use btoa to encode the cookie value
### https
Force https to children
### sendHeaderToChild
If false it avoids to send "ab-decider-child" header to the proxied endpoint
### headers
Headers to include in every response
const app = require("express")();
const { middleware: decider } = require("./index");
const port = process.env.PORT || 2323;
const port = process.env.PORT || 2323;
const nocache = require('nocache')

@@ -18,8 +19,10 @@ const resource = () => {

app.get("/test", (req, res)=>res.send("ok"))
app.get("/test", (req, res) => res.send("ok"))
app.use(
decider(resource, {hash:123})
decider(resource, {
hash: 123
})
);
app.listen(port, () => console.log(`running on ${port}`));
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