GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc: fix http and http2 writeEarlyHints() parameter · nodejs/node@e5f9a52

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • http.md
    • http2.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/http.md‎

Copy file name to clipboardExpand all lines: doc/api/http.md
+3-1Lines changed: 3 additions & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -2162,7 +2162,9 @@ response.writeEarlyHints({
21622162
});
21632163

21642164
const earlyHintsCallback = () => console.log('early hints message sent');
2165-
response.writeEarlyHints(earlyHintsLinks, earlyHintsCallback);
2165+
response.writeEarlyHints({
2166+
'link': earlyHintsLinks,
2167+
}, earlyHintsCallback);
21662168
```
21672169

21682170
### `response.writeHead(statusCode[, statusMessage][, headers])`
Collapse file

‎doc/api/http2.md‎

Copy file name to clipboardExpand all lines: doc/api/http2.md
+11-7Lines changed: 11 additions & 7 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -3773,7 +3773,7 @@ Removes a header that has been queued for implicit sending.
37733773
response.removeHeader('Content-Encoding');
37743774
```
37753775

3776-
### `response.req`
3776+
#### `response.req`
37773777

37783778
<!-- YAML
37793779
added: v15.7.0
@@ -3991,30 +3991,34 @@ Sends a status `100 Continue` to the client, indicating that the request body
39913991
should be sent. See the [`'checkContinue'`][] event on `Http2Server` and
39923992
`Http2SecureServer`.
39933993

3994-
### `response.writeEarlyHints(links)`
3994+
#### `response.writeEarlyHints(hints)`
39953995

39963996
<!-- YAML
39973997
added: v18.11.0
39983998
-->
39993999

4000-
* `links` {string|Array}
4000+
* `hints` {Object}
40014001

40024002
Sends a status `103 Early Hints` to the client with a Link header,
40034003
indicating that the user agent can preload/preconnect the linked resources.
4004-
The `links` can be a string or an array of strings containing the values
4005-
of the `Link` header.
4004+
The `hints` is an object containing the values of headers to be sent with
4005+
early hints message.
40064006

40074007
**Example**
40084008

40094009
```js
40104010
const earlyHintsLink = '</styles.css>; rel=preload; as=style';
4011-
response.writeEarlyHints(earlyHintsLink);
4011+
response.writeEarlyHints({
4012+
'link': earlyHintsLink,
4013+
});
40124014

40134015
const earlyHintsLinks = [
40144016
'</styles.css>; rel=preload; as=style',
40154017
'</scripts.js>; rel=preload; as=script',
40164018
];
4017-
response.writeEarlyHints(earlyHintsLinks);
4019+
response.writeEarlyHints({
4020+
'link': earlyHintsLinks,
4021+
});
40184022
```
40194023

40204024
#### `response.writeHead(statusCode[, statusMessage][, headers])`

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.