Skip to content

Commit c9aa06a

Browse files
authored
chore: patch http-proxy compatible with node22 (#16655)
1 parent 31f526f commit c9aa06a

File tree

3 files changed

+54
-3
lines changed

3 files changed

+54
-3
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@
122122
},
123123
"patchedDependencies": {
124124
125-
125+
126+
126127
},
127128
"peerDependencyRules": {
128129
"allowedVersions": {

patches/[email protected]

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
diff --git a/lib/http-proxy/common.js b/lib/http-proxy/common.js
2+
index 6513e81d80d5250ea249ea833f819ece67897c7e..486d4c896d65a3bb7cf63307af68facb3ddb886b 100644
3+
--- a/lib/http-proxy/common.js
4+
+++ b/lib/http-proxy/common.js
5+
@@ -1,6 +1,5 @@
6+
var common = exports,
7+
url = require('url'),
8+
- extend = require('util')._extend,
9+
required = require('requires-port');
10+
11+
var upgradeHeader = /(^|,)\s*upgrade\s*($|,)/i,
12+
@@ -40,10 +39,10 @@ common.setupOutgoing = function(outgoing, options, req, forward) {
13+
);
14+
15+
outgoing.method = options.method || req.method;
16+
- outgoing.headers = extend({}, req.headers);
17+
+ outgoing.headers = Object.assign({}, req.headers);
18+
19+
if (options.headers){
20+
- extend(outgoing.headers, options.headers);
21+
+ Object.assign(outgoing.headers, options.headers);
22+
}
23+
24+
if (options.auth) {
25+
diff --git a/lib/http-proxy/index.js b/lib/http-proxy/index.js
26+
index 977a4b3622b9eaac27689f06347ea4c5173a96cd..88b2d0fcfa03c3aafa47c7e6d38e64412c45a7cc 100644
27+
--- a/lib/http-proxy/index.js
28+
+++ b/lib/http-proxy/index.js
29+
@@ -1,5 +1,4 @@
30+
var httpProxy = module.exports,
31+
- extend = require('util')._extend,
32+
parse_url = require('url').parse,
33+
EE3 = require('eventemitter3'),
34+
http = require('http'),
35+
@@ -47,9 +46,9 @@ function createRightProxy(type) {
36+
args[cntr] !== res
37+
) {
38+
//Copy global options
39+
- requestOptions = extend({}, options);
40+
+ requestOptions = Object.assign({}, options);
41+
//Overwrite with request options
42+
- extend(requestOptions, args[cntr]);
43+
+ Object.assign(requestOptions, args[cntr]);
44+
45+
cntr--;
46+
}

pnpm-lock.yaml

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)