util._extend is deprecated

未关闭
#1,674 2 条评论 5 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
领域
networking

调研方向

检查 lib/http-proxy/common.js 和 lib/http-proxy/index.js,先从它们对 util._extend 的 import 以及 Node 22 的弃用警告开始。验证 Node 22 下受影响的 proxy 路径,并确认不再发出该警告,同时现有行为保持不变。

由索引模型根据 Issue 内容生成。

描述

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Node 22 reports:

(node:37843) [DEP0060] DeprecationWarning: The util._extend API is deprecated. Please use Object.assign() instead.

Here is the diff that solved my problem:

diff --git a/node_modules/http-proxy/lib/http-proxy/common.js b/node_modules/http-proxy/lib/http-proxy/common.js
index 6513e81..0555e80 100644
--- a/node_modules/http-proxy/lib/http-proxy/common.js
+++ b/node_modules/http-proxy/lib/http-proxy/common.js
@@ -1,6 +1,6 @@
 var common   = exports,
     url      = require('url'),
-    extend   = require('util')._extend,
+    extend   = Object.assign,
     required = require('requires-port');
 
 var upgradeHeader = /(^|,)\s*upgrade\s*($|,)/i,
diff --git a/node_modules/http-proxy/lib/http-proxy/index.js b/node_modules/http-proxy/lib/http-proxy/index.js
index 977a4b3..739409c 100644
--- a/node_modules/http-proxy/lib/http-proxy/index.js
+++ b/node_modules/http-proxy/lib/http-proxy/index.js
@@ -1,5 +1,5 @@
 var httpProxy = module.exports,
-    extend    = require('util')._extend,
+    extend    = Object.assign,
     parse_url = require('url').parse,
     EE3       = require('eventemitter3'),
     http      = require('http'),

This issue body was partially generated by patch-package.

主要语言
JavaScript
星标
14.1k
派生
2k
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

http-party/node-http-proxy 的其他 Issue

查看 http-party/node-http-proxy 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。