-
Notifications
You must be signed in to change notification settings - Fork 545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Argument is not a ByteString
when setting headers with non-ASCII characters
#1590
Comments
This behavior is expected, you can test it for yourself in the browser console: const headers = new Headers()
headers.set('link', '</_app/immutable/assets/__layout-a4ea7e9d.css>; rel="stylesheet"; nopush,</_app/immutable/start-cf8d1dd9.js>; rel="modulepreload"; nopush,</_app/immutable/chunks/index-bf47b8b5.js>; rel="modulepreload"; nopush,</_app/immutable/chunks/paths-98950022.js>; rel="modulepreload"; nopush,</_app/immutable/chunks/preload-helper-c28b9807.js>; rel="modulepreload"; nopush,</_app/immutable/chunks/singletons-1e28953d.js>; rel="modulepreload"; nopush,</_app/immutable/chunks/env-public-887c86aa.js>; rel="modulepreload"; nopush,</_app/immutable/pages/__layout.svelte-b3b95660.js>; rel="modulepreload"; nopush,</_app/immutable/chunks/navigation-c4179065.js>; rel="modulepreload"; nopush,</_app/immutable/pages/encoded/苗条.svelte-7e7988f6.js>; rel="modulepreload"; nopush,</_app/immutable/chunks/stores-2e0a9bb3.js>; rel="modulepreload"; nopush')
Agreed, the errors around the webidl stuff should be improved.
A ByteString is not a JS string; it can only contain ASCII and 8-bit characters (char codes between 128 - 255). The reason this string is throwing an error is because of the characters The webidl for the headers class indicates for implementations to convert both parameters of For more info, see:
|
I'm going to re-open this until there are better error messages |
Thanks for the clarification! The improved error will help some. I'd probably still be confused that it was trying to convert it to a |
I've updated MDN: mdn/content#19166 I'll leave updating TypeScript's |
Bug Description
It looks like #1317 wasn't actually fixed
Reproducible By
I got this while setting the
link
header to the following value:Expected Behavior
I think this should work. If it's invalid in some way, the error message should certainly be clarified. I passed a
string
which is valid, so it shouldn't be complaining about wanting aByteString
Logs & Screenshots
Environment
Undici 5.8.1
Node 16.15.0
Ubuntu 22.04
Additional context
This is blocking the SvelteKit web framework from setting the
link
headerThe text was updated successfully, but these errors were encountered: