From e9627ab18e79e09db70daaab96bf13c223a48d9e Mon Sep 17 00:00:00 2001 From: Jimmy Leung <43258070+hkleungai@users.noreply.github.com> Date: Sun, 6 Oct 2024 13:17:16 +0800 Subject: [PATCH] doc: fix the return type of outgoingMessage.setHeaders() The actual implementation returns `outgoingMessage` itself, but not exactly `http.ServerResponse`. Refs: https://github.com/nodejs/node/blob/20d8b85d3493bec944de541a896e0165dd356345/lib/_http_outgoing.js#L712-L751 --- doc/api/http.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/doc/api/http.md b/doc/api/http.md index 09d950a0734a1e..9b9175a003f56c 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -3289,9 +3289,7 @@ added: --> * `headers` {Headers|Map} -* Returns: {http.ServerResponse} - -Returns the response object. +* Returns: {this} Sets multiple header values for implicit headers. `headers` must be an instance of [`Headers`][] or `Map`, @@ -3300,14 +3298,14 @@ its value will be replaced. ```js const headers = new Headers({ foo: 'bar' }); -response.setHeaders(headers); +outgoingMessage.setHeaders(headers); ``` or ```js const headers = new Map([['foo', 'bar']]); -res.setHeaders(headers); +outgoingMessage.setHeaders(headers); ``` When headers have been set with [`outgoingMessage.setHeaders()`][],