nodejs / nodejs/node

Missing `Http2ServerResponse.setHeaders()`

未关闭
#51,573 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

feature request http2
主要语言
JavaScript
星标
122k
派生
37.4k
平均合并
4 天 3 小时
30 天内合并 PR
272

描述

What is the problem this feature will solve?

Make it possible to use response.setHeaders() on both old HTTP response objects and ones coming from node:http2.

BTW I wasn't sure if this should be a "feature request" or a "bug."

What is the feature you are proposing to solve the problem?

Add the method http2.Http2ServerResponse.setHeaders() to have the same API as http.OutgoingMessage.setHeaders().

See https://nodejs.org/api/http.html#outgoingmessagesetheadersheaders.

What alternatives have you considered?
  • Avoiding using setHeaders() at all.
  • Monkey-patching Http2ServerResponse.
  • Just writing two versions of my own set-headers code, on the assumption that, when available, setHeaders() is the most efficient option.

贡献指南

打开贡献指南

从这里开始

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

调研方向

从 node:http2 Http2ServerResponse 入口点开始,并以链接的 HTTP 文档作为行为参考,将其 API 与 http.OutgoingMessage.setHeaders() 进行比较。完成意味着 Http2ServerResponse 以与现有 HTTP 响应对象相同的 API 和行为提供 setHeaders(),并为新方法提供适当的覆盖。

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

评估

技术栈
javascript, node.js
领域
api, backend
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
52/100

把新 issue 发到你的邮箱

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