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

@podium/proxy

Package Overview
Dependencies
Maintainers
5
Versions
158
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@podium/proxy - npm Package Compare versions

Comparing version 4.0.0-next.2 to 4.0.0-next.3

71

lib/proxy.js

@@ -53,3 +53,6 @@ 'use strict';

this.registry.on('error', error => {
this.log.error('Error emitted by the registry in @podium/proxy module', error);
this.log.error(
'Error emitted by the registry in @podium/proxy module',
error,
);
});

@@ -86,29 +89,15 @@

this.metrics.on('error', error => {
this.log.error('Error emitted by metric stream in @podium/proxy module', error);
this.log.error(
'Error emitted by metric stream in @podium/proxy module',
error,
);
});
this.proxy.on('error', error => {
this.log.error('Error emitted by proxy in @podium/proxy module', error);
this.log.error(
'Error emitted by proxy in @podium/proxy module',
error,
);
});
this.proxy.on('proxyReq', (proxyReq, req, res) => {
const end = this.metrics.timer({
name: 'podium_proxy_request',
description:
'Proxy requests through a layout to target determined by podlet manifest',
/*
TODO: we can not count like this due to not having res.locals
when stuff is framework free
meta: {
podlet: res.locals.podlet,
proxy: res.locals.proxy,
},
*/
});
res.on('finish', () => {
end();
});
});
this.registry.on('set', (key, item) => {

@@ -143,5 +132,6 @@ Object.keys(item.proxy).forEach(name => {

if (validate.manifest(obj).error) throw new Error(
'The value for the required argument "manifest" is not defined or not valid.'
);
if (validate.manifest(obj).error)
throw new Error(
'The value for the required argument "manifest" is not defined or not valid.',
);

@@ -159,2 +149,14 @@ this.registry.set(obj.name, obj, Infinity);

const histogram = this.metrics.histogram({
name: 'podium_proxy_process',
description: 'Measures time spent in the proxy process method',
labels: {
name: incoming.name,
podlet: null,
proxy: false,
error: false,
},
});
const endTimer = histogram.timer();
return new Promise((resolve, reject) => {

@@ -175,2 +177,3 @@ const match = this.pathnameParser.exec(incoming.url.pathname);

if (!manifest) {
endTimer({ labels: { podlet: params.podiumPodletName } });
resolve(incoming);

@@ -184,2 +187,3 @@ return;

if (!target) {
endTimer({ labels: { podlet: params.podiumPodletName } });
resolve(incoming);

@@ -236,3 +240,10 @@ return;

incoming.response.on('finish', () => {
// eslint-disable-next-line no-param-reassign
incoming.proxy = true;
endTimer({
labels: {
podlet: params.podiumPodletName,
proxy: true,
},
});
resolve(incoming);

@@ -246,2 +257,9 @@ });

error => {
endTimer({
labels: {
podlet: params.podiumPodletName,
proxy: true,
error: true,
},
});
reject(error);

@@ -253,2 +271,3 @@ },

}
endTimer();
resolve(incoming);

@@ -255,0 +274,0 @@ });

{
"name": "@podium/proxy",
"version": "4.0.0-next.2",
"version": "4.0.0-next.3",
"description": "Transparent http proxy. Dynamically mounts proxy targets on an existing HTTP server instance.",

@@ -5,0 +5,0 @@ "license": "MIT",

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