From 0e14f5f04af16bc7c35ab2f767e5ce23de3d777a Mon Sep 17 00:00:00 2001 From: Podugboch Date: Mon, 19 Oct 2026 22:37:23 +0100 Subject: [PATCH] Bump http-proxy-middleware to 3.0.0 (#5178) --- CHANGELOG.md | 1 + packages/test/harness/package.json | 6 +--- .../harness/src/host/jest-server/index.js | 28 ++++++++++--------- .../app/src/setupProxy.js | 4 +-- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d32d8a4300..4315851d2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ Legends: - 💥 `useSendMessage`: `init.attachments[].thumbnailURL` must be data URI, otherwise will be ignored, in PR [#5871](https://github.com/microsoft/BotFramework-WebChat/pull/5871), by [@compulim](https://github.com/compulim) - 👷🏻 Visual regression tests now use 5 consecutive screenshots for stability indication, up from 2, in PR [#5871](https://github.com/microsoft/BotFramework-WebChat/pull/5871), by [@compulim](https://github.com/compulim) +- 👷🏻 Bumped `http-proxy-middleware` to 3.0.0, fixes [#5178](https://github.com/microsoft/BotFramework-WebChat/issues/5178), by [@Podugboch](https://github.com/Podugboch) ### Removed diff --git a/packages/test/harness/package.json b/packages/test/harness/package.json index 7274ea0e7d..367ab7b0ea 100644 --- a/packages/test/harness/package.json +++ b/packages/test/harness/package.json @@ -38,10 +38,6 @@ "3", "global-agent@4 changed its signature, need time to migrate" ], - "http-proxy-middleware": [ - "2", - "http-proxy-middleware@3 has breaking changes, need time to migrate" - ], "jest": [ "29", "jest@30 is not supported by jest-image-snapshot@6.5.1" @@ -61,7 +57,7 @@ "esbuild": "^0.28.0", "express": "^5.2.1", "global-agent": "^3.0.0", - "http-proxy-middleware": "^2.0.9", + "http-proxy-middleware": "^3.0.0", "istanbul-lib-coverage": "^3.2.2", "jest": "^29.7.0", "jest-environment-node": "^29.7.0", diff --git a/packages/test/harness/src/host/jest-server/index.js b/packages/test/harness/src/host/jest-server/index.js index b8f4ff7d34..475cf50c9e 100644 --- a/packages/test/harness/src/host/jest-server/index.js +++ b/packages/test/harness/src/host/jest-server/index.js @@ -195,25 +195,27 @@ async function prepareSession(sessionId) { }, createProxyMiddleware({ ...DEFAULT_PROXY_OPTIONS, - onProxyRes: responseInterceptor(async responseBuffer => { - const session = JSON.parse(responseBuffer.toString()); + on: { + proxyRes: responseInterceptor(async responseBuffer => { + const session = JSON.parse(responseBuffer.toString()); - const entry = { busy: true, numUsed: 1, session, sessionId: session.value.sessionId, startTime: Date.now() }; + const entry = { busy: true, numUsed: 1, session, sessionId: session.value.sessionId, startTime: Date.now() }; - pool.push(entry); + pool.push(entry); - setTimeout(() => housekeep(pool), INSTANCE_LIFE - INSTANCE_MIN_LIFE); + setTimeout(() => housekeep(pool), INSTANCE_LIFE - INSTANCE_MIN_LIFE); - await prepareSession(entry.sessionId); + await prepareSession(entry.sessionId); - console.log( - `New instance ${entry.sessionId} created. Now the pool has ${pool.length} instances: [${pool - .map(runLeft) - .join(', ')}].` - ); + console.log( + `New instance ${entry.sessionId} created. Now the pool has ${pool.length} instances: [${pool + .map(runLeft) + .join(', ')}].` + ); - return responseBuffer; - }), + return responseBuffer; + }) + }, selfHandleResponse: true }) ); diff --git a/samples/07.advanced-web-chat-apps/b.sso-for-enterprise/app/src/setupProxy.js b/samples/07.advanced-web-chat-apps/b.sso-for-enterprise/app/src/setupProxy.js index 2d62cc6ec6..a946314aa3 100644 --- a/samples/07.advanced-web-chat-apps/b.sso-for-enterprise/app/src/setupProxy.js +++ b/samples/07.advanced-web-chat-apps/b.sso-for-enterprise/app/src/setupProxy.js @@ -1,6 +1,6 @@ -const proxy = require('http-proxy-middleware'); +const { createProxyMiddleware } = require('http-proxy-middleware'); // Passthru-ing API traffic to /rest-api/ module.exports = app => { - app.use(proxy('/api', { target: 'http://localhost:5000/' })); + app.use(createProxyMiddleware('/api', { target: 'http://localhost:5000/' })); };