From 239aaf3a7de1ce40dac1416c5c9df72a39e6d249 Mon Sep 17 00:00:00 2001 From: Niklas Mollenhauer Date: Thu, 25 Apr 2024 12:48:06 +0200 Subject: [PATCH 1/2] Use `Object.assign` instead of deprecated `util._extend` Resolves: ``` [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead. ``` When using Node.js 22 --- lib/http-proxy/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/http-proxy/index.js b/lib/http-proxy/index.js index 977a4b362..88b2d0fcf 100644 --- a/lib/http-proxy/index.js +++ b/lib/http-proxy/index.js @@ -1,5 +1,4 @@ var httpProxy = module.exports, - extend = require('util')._extend, parse_url = require('url').parse, EE3 = require('eventemitter3'), http = require('http'), @@ -47,9 +46,9 @@ function createRightProxy(type) { args[cntr] !== res ) { //Copy global options - requestOptions = extend({}, options); + requestOptions = Object.assign({}, options); //Overwrite with request options - extend(requestOptions, args[cntr]); + Object.assign(requestOptions, args[cntr]); cntr--; } From b42c38fc3486ee8ad4374cc2397458b6e4cd99ca Mon Sep 17 00:00:00 2001 From: Niklas Mollenhauer Date: Thu, 25 Apr 2024 12:50:05 +0200 Subject: [PATCH 2/2] Use `Object.assign` instead of deprecated `util._extend` --- lib/http-proxy/common.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/http-proxy/common.js b/lib/http-proxy/common.js index 6513e81d8..486d4c896 100644 --- a/lib/http-proxy/common.js +++ b/lib/http-proxy/common.js @@ -1,6 +1,5 @@ var common = exports, url = require('url'), - extend = require('util')._extend, required = require('requires-port'); var upgradeHeader = /(^|,)\s*upgrade\s*($|,)/i, @@ -40,10 +39,10 @@ common.setupOutgoing = function(outgoing, options, req, forward) { ); outgoing.method = options.method || req.method; - outgoing.headers = extend({}, req.headers); + outgoing.headers = Object.assign({}, req.headers); if (options.headers){ - extend(outgoing.headers, options.headers); + Object.assign(outgoing.headers, options.headers); } if (options.auth) {