Socket
Socket
Sign inDemoInstall

http-proxy-middleware

Package Overview
Dependencies
26
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.1 to 2.0.2

4

dist/_handlers.js

@@ -5,3 +5,3 @@ "use strict";

const logger_1 = require("./logger");
const logger = logger_1.getInstance();
const logger = (0, logger_1.getInstance)();
function init(proxy, option) {

@@ -70,3 +70,3 @@ const handlers = getHandlers(option);

}
res.end(`Error occured while trying to proxy: ${host}${req.url}`);
res.end(`Error occurred while trying to proxy: ${host}${req.url}`);
}

@@ -73,0 +73,0 @@ function logClose(req, socket, head) {

@@ -8,3 +8,3 @@ "use strict";

const logger_1 = require("./logger");
const logger = logger_1.getInstance();
const logger = (0, logger_1.getInstance)();
function createConfig(context, opts) {

@@ -11,0 +11,0 @@ // structure of config object to be returned

@@ -10,3 +10,3 @@ "use strict";

const requestBody = req.body;
if (!requestBody || !Object.keys(requestBody).length) {
if (!requestBody) {
return;

@@ -13,0 +13,0 @@ }

@@ -13,3 +13,3 @@ "use strict";

constructor(context, opts) {
this.logger = logger_1.getInstance();
this.logger = (0, logger_1.getInstance)();
this.wsInternalSubscribed = false;

@@ -102,3 +102,3 @@ this.serverOnCloseSubscribed = false;

if (this.proxyOptions.logLevel === 'debug') {
const arrow = logger_1.getArrow(originalPath, req.url, this.proxyOptions.target, newProxyOptions.target);
const arrow = (0, logger_1.getArrow)(originalPath, req.url, this.proxyOptions.target, newProxyOptions.target);
this.logger.debug('[HPM] %s %s %s %s', req.method, originalPath, arrow, newProxyOptions.target);

@@ -140,3 +140,3 @@ }

};
this.config = config_factory_1.createConfig(context, opts);
this.config = (0, config_factory_1.createConfig)(context, opts);
this.proxyOptions = this.config.options;

@@ -143,0 +143,0 @@ // create proxy

@@ -7,3 +7,3 @@ "use strict";

const logger_1 = require("./logger");
const logger = logger_1.getInstance();
const logger = (0, logger_1.getInstance)();
/**

@@ -10,0 +10,0 @@ * Create rewrite function, to cache parsed rewrite rules.

@@ -6,3 +6,3 @@ "use strict";

const logger_1 = require("./logger");
const logger = logger_1.getInstance();
const logger = (0, logger_1.getInstance)();
async function getTarget(req, config) {

@@ -9,0 +9,0 @@ let newTarget;

@@ -48,8 +48,8 @@ /**

*/
export declare type OnErrorCallback = (err: Error, req: http.IncomingMessage, res: http.ServerResponse, target?: string | Partial<url.Url>) => void;
export declare type OnProxyResCallback = (proxyRes: http.IncomingMessage, req: http.IncomingMessage, res: http.ServerResponse) => void;
export declare type OnProxyReqCallback = (proxyReq: http.ClientRequest, req: http.IncomingMessage, res: http.ServerResponse, options: httpProxy.ServerOptions) => void;
export declare type OnProxyReqWsCallback = (proxyReq: http.ClientRequest, req: http.IncomingMessage, socket: net.Socket, options: httpProxy.ServerOptions, head: any) => void;
export declare type OnCloseCallback = (proxyRes: http.IncomingMessage, proxySocket: net.Socket, proxyHead: any) => void;
export declare type OnErrorCallback = (err: Error, req: Request, res: Response, target?: string | Partial<url.Url>) => void;
export declare type OnProxyResCallback = (proxyRes: http.IncomingMessage, req: Request, res: Response) => void;
export declare type OnProxyReqCallback = (proxyReq: http.ClientRequest, req: Request, res: Response, options: httpProxy.ServerOptions) => void;
export declare type OnProxyReqWsCallback = (proxyReq: http.ClientRequest, req: Request, socket: net.Socket, options: httpProxy.ServerOptions, head: any) => void;
export declare type OnCloseCallback = (proxyRes: Response, proxySocket: net.Socket, proxyHead: any) => void;
export declare type OnOpenCallback = (proxySocket: net.Socket) => void;
export {};
{
"name": "http-proxy-middleware",
"version": "2.0.1",
"version": "2.0.2",
"description": "The one-liner node.js proxy middleware for connect, express and browser-sync",

@@ -24,3 +24,5 @@ "main": "dist/index.js",

"coverage": "jest --coverage --coverageReporters=lcov",
"prepare": "husky install && yarn build && rm dist/tsconfig.tsbuildinfo"
"prepare": "husky install",
"prepack": "yarn build && rm dist/tsconfig.tsbuildinfo",
"spellcheck": "npx --yes cspell --show-context --show-suggestions '**/*.*'"
},

@@ -55,34 +57,34 @@ "repository": {

"devDependencies": {
"@commitlint/cli": "^12.1.4",
"@commitlint/config-conventional": "^12.1.4",
"@types/express": "4.17.7",
"@types/is-glob": "^4.0.1",
"@types/jest": "^26.0.23",
"@types/micromatch": "^4.0.1",
"@types/node": "^15.6.2",
"@types/supertest": "^2.0.11",
"@types/ws": "^7.4.4",
"@typescript-eslint/eslint-plugin": "^4.26.0",
"@typescript-eslint/parser": "^4.26.0",
"body-parser": "^1.19.0",
"browser-sync": "^2.26.14",
"connect": "^3.7.0",
"eslint": "^7.27.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"express": "^4.17.1",
"get-port": "^5.1.1",
"husky": "^6.0.0",
"jest": "^27.0.3",
"lint-staged": "^11.0.0",
"mockttp": "^1.2.2",
"open": "^8.2.0",
"prettier": "^2.3.0",
"supertest": "^6.1.3",
"ts-jest": "^27.0.2",
"typescript": "^4.3.2",
"ws": "^7.4.6"
"@commitlint/cli": "16.1.0",
"@commitlint/config-conventional": "16.0.0",
"@types/express": "4.17.13",
"@types/is-glob": "4.0.2",
"@types/jest": "27.4.0",
"@types/micromatch": "4.0.2",
"@types/node": "17.0.10",
"@types/supertest": "2.0.11",
"@types/ws": "8.2.2",
"@typescript-eslint/eslint-plugin": "5.10.0",
"@typescript-eslint/parser": "5.10.0",
"body-parser": "1.19.1",
"browser-sync": "2.27.7",
"connect": "3.7.0",
"eslint": "8.7.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-prettier": "4.0.0",
"express": "4.17.2",
"get-port": "5.1.1",
"husky": "7.0.4",
"jest": "27.4.7",
"lint-staged": "12.2.2",
"mockttp": "2.5.1",
"open": "8.4.0",
"prettier": "2.5.1",
"supertest": "6.2.2",
"ts-jest": "27.1.3",
"typescript": "4.5.5",
"ws": "8.4.2"
},
"dependencies": {
"@types/http-proxy": "^1.17.5",
"@types/http-proxy": "^1.17.8",
"http-proxy": "^1.18.1",

@@ -93,2 +95,5 @@ "is-glob": "^4.0.1",

},
"peerDependencies": {
"@types/express": "^4.17.13"
},
"engines": {

@@ -95,0 +100,0 @@ "node": ">=12.0.0"

@@ -5,3 +5,2 @@ # http-proxy-middleware

[![Coveralls](https://img.shields.io/coveralls/chimurai/http-proxy-middleware.svg?style=flat-square)](https://coveralls.io/r/chimurai/http-proxy-middleware)
[![dependency Status](https://img.shields.io/david/chimurai/http-proxy-middleware.svg?style=flat-square)](https://david-dm.org/chimurai/http-proxy-middleware#info=dependencies)
[![dependency Status](https://snyk.io/test/npm/http-proxy-middleware/badge.svg?style=flat-square)](https://snyk.io/test/npm/http-proxy-middleware)

@@ -132,2 +131,3 @@ [![npm](https://img.shields.io/npm/v/http-proxy-middleware?color=%23CC3534&style=flat-square)](https://www.npmjs.com/package/http-proxy-middleware)

// proxy middleware options
/** @type {import('http-proxy-middleware/dist/types').Options} */
const options = {

@@ -346,3 +346,3 @@ target: 'http://www.example.org', // target host

// listen for messages coming FROM the target here
proxySocket.on('data', hybiParseAndLogMessage);
proxySocket.on('data', hybridParseAndLogMessage);
}

@@ -592,2 +592,5 @@ ```

$ yarn cover
# check spelling mistakes
$ yarn spellcheck
```

@@ -603,2 +606,2 @@

Copyright (c) 2015-2021 Steven Chim
Copyright (c) 2015-2022 Steven Chim
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc