Summary
Regression surfaced by re-measuring node:http parity on current main. test-http-client-defaults was fixed by #4904 (Agent/ClientRequest constructable), but the header-validation added in #4907 now over-fires on an empty/falsy method:
const req = new ClientRequest({ method: '', createConnection: () => {} });
assert.strictEqual(req.method, 'GET'); // Node defaults falsy method → 'GET'
Perry throws:
TypeError: Method must be a valid HTTP token [""]
Node treats a falsy method ('', undefined) as the default 'GET' — it does not validate-reject it. The validateHeaderName-style HTTP-token check from #4907 must only apply to a non-empty method; empty/falsy must fall through to the 'GET' default.
Repro
test-http-client-defaults.js (Node v22 test/parallel) — currently runtime-fail, was pass at the prior measurement.
Acceptance
new ClientRequest({ method: '' }) and ({ method: undefined }) default req.method to 'GET'; only a non-empty invalid token throws ERR_INVALID_HTTP_TOKEN. test-http-client-defaults back to pass, no re-break of #4907's validation tests.
Regression from #4907. Found re-measuring #2132's corpus on main (parity 26.2%).
Summary
Regression surfaced by re-measuring node:http parity on current
main.test-http-client-defaultswas fixed by #4904 (Agent/ClientRequest constructable), but the header-validation added in #4907 now over-fires on an empty/falsymethod:Perry throws:
Node treats a falsy
method('',undefined) as the default'GET'— it does not validate-reject it. ThevalidateHeaderName-style HTTP-token check from #4907 must only apply to a non-empty method; empty/falsy must fall through to the'GET'default.Repro
test-http-client-defaults.js(Node v22test/parallel) — currentlyruntime-fail, waspassat the prior measurement.Acceptance
new ClientRequest({ method: '' })and({ method: undefined })defaultreq.methodto'GET'; only a non-empty invalid token throwsERR_INVALID_HTTP_TOKEN.test-http-client-defaultsback to pass, no re-break of #4907's validation tests.Regression from #4907. Found re-measuring #2132's corpus on
main(parity 26.2%).