doc: fix overstated Date header requirement in response.sendDate

The docs stated "HTTP requires the Date header in responses" which
oversimplifies the actual requirement. Per RFC 9110 Section 6.6.1,
the Date header is required only in most responses (2xx/3xx/4xx from
servers with a clock), not all. Reference the specific RFC section.

Fixes: https://github.com/nodejs/node/issues/42619

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR-URL: https://github.com/nodejs/node/pull/62206
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Kit DallegeandClaude Opus 4.6 authored and GitHub committed 2026-03-24 10:49:30 +00:00
1 parent a98d9f6ad7
commit 02104c08bb
1 file changed
+3 -2
+3 -2
View File
@@ -2319,8 +2319,8 @@ added: v0.7.5
When true, the Date header will be automatically generated and sent in
the response if it is not already present in the headers. Defaults to true.
This should only be disabled for testing; HTTP requires the Date header
in responses.
This should only be disabled for testing; the Date header is required in
most HTTP responses (see [RFC 9110 Section 6.6.1][] for details).
### `response.setHeader(name, value)`
@@ -4583,6 +4583,7 @@ const agent2 = new http.Agent({ proxyEnv: process.env });
[Built-in Proxy Support]: #built-in-proxy-support
[RFC 8187]: https://www.rfc-editor.org/rfc/rfc8187.txt
[RFC 9110 Section 6.6.1]: https://www.rfc-editor.org/rfc/rfc9110#section-6.6.1
[`'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`]: errors.md#err_http_content_length_mismatch
[`'checkContinue'`]: #event-checkcontinue
[`'finish'`]: #event-finish