http-proxy-middleware
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -7,4 +7,4 @@ "use strict"; | ||
// don't load default errorResponsePlugin if user has specified their own | ||
const maybeErrorResponsePlugin = !!options.on?.error ? [] : [default_1.errorResponsePlugin]; | ||
const defaultPlugins = !!options.ejectPlugins | ||
const maybeErrorResponsePlugin = options.on?.error ? [] : [default_1.errorResponsePlugin]; | ||
const defaultPlugins = options.ejectPlugins | ||
? [] // no default plugins when ejecting | ||
@@ -11,0 +11,0 @@ : [default_1.debugProxyErrorsPlugin, default_1.proxyEventsPlugin, default_1.loggerPlugin, ...maybeErrorResponsePlugin]; |
@@ -25,7 +25,7 @@ "use strict"; | ||
catch (err) { | ||
next && next(err); | ||
next?.(err); | ||
} | ||
} | ||
else { | ||
next && next(); | ||
next?.(); | ||
} | ||
@@ -32,0 +32,0 @@ /** |
"use strict"; | ||
/* eslint-disable @typescript-eslint/no-empty-function */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -4,0 +3,0 @@ exports.getLogger = getLogger; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createPathRewriter = createPathRewriter; | ||
const isPlainObj = require("is-plain-obj"); | ||
const is_plain_object_1 = require("is-plain-object"); | ||
const errors_1 = require("./errors"); | ||
@@ -43,3 +43,3 @@ const debug_1 = require("./debug"); | ||
} | ||
else if (isPlainObj(rewriteConfig)) { | ||
else if ((0, is_plain_object_1.isPlainObject)(rewriteConfig)) { | ||
return Object.keys(rewriteConfig).length !== 0; | ||
@@ -56,3 +56,3 @@ } | ||
const rules = []; | ||
if (isPlainObj(rewriteConfig)) { | ||
if ((0, is_plain_object_1.isPlainObject)(rewriteConfig)) { | ||
for (const [key, value] of Object.entries(rewriteConfig)) { | ||
@@ -59,0 +59,0 @@ rules.push({ |
@@ -29,12 +29,22 @@ "use strict"; | ||
// construct targetUrl | ||
const port = (0, logger_plugin_1.getPort)(proxyRes.req?.agent?.sockets); | ||
const obj = { | ||
protocol: proxyRes.req.protocol, | ||
host: proxyRes.req.host, | ||
pathname: proxyRes.req.path, | ||
}; | ||
const target = new url_1.URL(`${obj.protocol}//${obj.host}${obj.pathname}`); | ||
if (port) { | ||
target.port = port; | ||
let target; | ||
try { | ||
const port = (0, logger_plugin_1.getPort)(proxyRes.req?.agent?.sockets); | ||
const obj = { | ||
protocol: proxyRes.req.protocol, | ||
host: proxyRes.req.host, | ||
pathname: proxyRes.req.path, | ||
}; | ||
target = new url_1.URL(`${obj.protocol}//${obj.host}${obj.pathname}`); | ||
if (port) { | ||
target.port = port; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
} | ||
catch (err) { | ||
// nock issue (https://github.com/chimurai/http-proxy-middleware/issues/1035) | ||
// fallback to old implementation (less correct - without port) | ||
target = new url_1.URL(options.target); | ||
target.pathname = proxyRes.req.path; | ||
} | ||
const targetUrl = target.toString(); | ||
@@ -41,0 +51,0 @@ const exchange = `[HPM] ${req.method} ${originalUrl} -> ${targetUrl} [${proxyRes.statusCode}]`; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getTarget = getTarget; | ||
const isPlainObj = require("is-plain-obj"); | ||
const is_plain_object_1 = require("is-plain-object"); | ||
const debug_1 = require("./debug"); | ||
@@ -10,3 +10,3 @@ const debug = debug_1.Debug.extend('router'); | ||
const router = config.router; | ||
if (isPlainObj(router)) { | ||
if ((0, is_plain_object_1.isPlainObject)(router)) { | ||
newTarget = getTargetFromProxyTable(req, router); | ||
@@ -13,0 +13,0 @@ } |
"use strict"; | ||
/* eslint-disable @typescript-eslint/ban-types */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-function-type */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -4,0 +4,0 @@ exports.getFunctionName = getFunctionName; |
{ | ||
"name": "http-proxy-middleware", | ||
"type": "commonjs", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "The one-liner node.js proxy middleware for connect, express, next.js and more", | ||
@@ -16,3 +16,3 @@ "main": "dist/index.js", | ||
"lint:fix": "yarn prettier:fix && yarn eslint:fix", | ||
"eslint": "eslint '{src,test}/**/*.ts' --cache", | ||
"eslint": "eslint '{src,test,examples}/**/*.{js,ts}' --cache", | ||
"eslint:fix": "yarn eslint --fix", | ||
@@ -62,3 +62,6 @@ "prettier": "prettier --list-different \"**/*.{js,ts,md,yml,json,html}\"", | ||
"@commitlint/config-conventional": "19.4.1", | ||
"@eslint/js": "9.9.1", | ||
"@types/debug": "4.1.12", | ||
"@types/eslint": "9.6.1", | ||
"@types/eslint__js": "8.42.3", | ||
"@types/express": "4.17.21", | ||
@@ -71,6 +74,4 @@ "@types/is-glob": "4.0.4", | ||
"@types/ws": "8.5.12", | ||
"@typescript-eslint/eslint-plugin": "7.16.0", | ||
"@typescript-eslint/parser": "7.16.0", | ||
"body-parser": "1.20.2", | ||
"eslint": "8.57.0", | ||
"eslint": "9.9.1", | ||
"eslint-config-prettier": "9.1.0", | ||
@@ -80,2 +81,3 @@ "eslint-plugin-prettier": "5.2.1", | ||
"get-port": "5.1.1", | ||
"globals": "15.9.0", | ||
"husky": "9.1.5", | ||
@@ -90,2 +92,3 @@ "jest": "29.7.0", | ||
"typescript": "5.5.4", | ||
"typescript-eslint": "8.3.0", | ||
"ws": "8.18.0" | ||
@@ -98,3 +101,3 @@ }, | ||
"is-glob": "^4.0.3", | ||
"is-plain-obj": "^3.0.0", | ||
"is-plain-object": "^5.0.0", | ||
"micromatch": "^4.0.8" | ||
@@ -101,0 +104,0 @@ }, |
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
81022
1342
31
+ Addedis-plain-object@^5.0.0
+ Addedis-plain-object@5.0.0(transitive)
- Removedis-plain-obj@^3.0.0
- Removedis-plain-obj@3.0.0(transitive)