mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
doc: add note about header values encoding
PR-URL: https://github.com/nodejs/node/pull/42624 Fixes: https://github.com/nodejs/node/issues/42579 Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
1 parent
b99bb57416
commit
dfc2dc8b65
1 file changed
+12
@@ -987,6 +987,17 @@ or
|
||||
request.setHeader('Cookie', ['type=ninja', 'language=javascript']);
|
||||
```
|
||||
|
||||
When the value is a string an exception will be thrown if it contains
|
||||
characters outside the `latin1` encoding.
|
||||
|
||||
If you need to pass UTF-8 characters in the value please encode the value
|
||||
using the [RFC 8187][] standard.
|
||||
|
||||
```js
|
||||
const filename = 'Rock 🎵.txt';
|
||||
request.setHeader('Content-Disposition', `attachment; filename*=utf-8''${encodeURIComponent(filename)}`);
|
||||
```
|
||||
|
||||
### `request.setNoDelay([noDelay])`
|
||||
|
||||
<!-- YAML
|
||||
@@ -3406,6 +3417,7 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
[RFC 8187]: https://www.rfc-editor.org/rfc/rfc8187.txt
|
||||
[`'checkContinue'`]: #event-checkcontinue
|
||||
[`'finish'`]: #event-finish
|
||||
[`'request'`]: #event-request
|
||||
|
||||
Reference in new issue
Block a user