`req.getHeaders()` does not return values set using "rawHeaders" array
オープン
まだ誰も着手していません。
http
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.3k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 283
説明
Version
v24.18.0
Platform
Darwin MBPM.local 25.5.0 Darwin Kernel Version 25.5.0: Tue Jun 9 22:28:29 PDT 2026; root:xnu-12377.121.10~1/RELEASE_ARM64_T6030 arm64
Subsystem
http
What steps will reproduce the bug?
Headers set using the message.rawHeaders format are not available on the request's getHeaders() method
import { get } from 'node:http'
const request = get(
'http://localhost:3000',
{
headers: ['foo', 'bar', 'baz', 'qux']
},
(res) => {
let data = ''
res.on('data', (chunk) => {
data += chunk
})
res.on('end', () => {
console.log(data)
})
}
)
request.on('error', () => {})
console.log(request.getHeaders()) // [Object: null prototype] {}
console.log(request.getHeaderNames()) // []
console.log(request.getRawHeaderNames()) // []
console.log(request._header) // GET / HTTP/1.1\r\nfoo: bar\r\nbaz: qux\r\nConnection: keep-alive
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
One would expect req.getHeaders() (and friends) to return a consistent value, whether an object or an array was passed as argument.
What do you see instead?
req.getHeaders() appears to be empty when request options are built using an array notation.
Additional information
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
node:http のリクエストエントリポイントから開始し、getHeaders()、getHeaderNames()、getRawHeaderNames() が呼び出される前に options.headers 配列がどのように格納されるかを追跡します。例を再現し、これらのメソッドがオブジェクト形式のオプションと一貫してヘッダーを報告しつつ、送出されるリクエストヘッダーを保持することを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, nodejs
- 領域
- api, backend
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 52/100