Skip to content

Argument is not a ByteString when setting headers with non-ASCII characters #1590

@benmccann

Description

@benmccann

Bug Description

It looks like #1317 wasn't actually fixed

Reproducible By

I got this while setting the link header to the following value:

</_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

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 a ByteString

Logs & Screenshots

TypeError: Argument is not a ByteString
    at Object.webidl.converters.ByteString (node_modules/.pnpm/[email protected]/node_modules/undici/lib/fetch/webidl.js:404:11)
    at Headers.set (node_modules/.pnpm/[email protected]/node_modules/undici/lib/fetch/headers.js:362:31)
    at render_response (packages/kit/test/apps/basics/.svelte-kit/output/server/_app/immutable/chunks/index-fb484aa3.js:1090:13)
    at respond$1 (packages/kit/test/apps/basics/.svelte-kit/output/server/_app/immutable/chunks/index-fb484aa3.js:2013:25)
    at resolve (packages/kit/test/apps/basics/.svelte-kit/output/server/_app/immutable/chunks/index-fb484aa3.js:2261:114)
    at packages/kit/test/apps/basics/.svelte-kit/output/server/_app/immutable/chunks/hooks-a33195ff.js:44:20
    at respond (packages/kit/test/apps/basics/.svelte-kit/output/server/_app/immutable/chunks/index-fb484aa3.js:2213:22)
    at packages/kit/src/vite/preview/index.js:142:5

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 header

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions