-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
docs: handle immutable headers error #12543
Conversation
|
I don't think this is the proper way to suggest handling this. If it's important that this header be set, you don't want to just be silently failing and ignoring that. See e.g. the way this is handled in #10030. |
It definitely is not a proper way to handle this problem. However, the current documentation is prone to runtime errors. And I didn't want to mention cloning responses just for this exception. // the returned Response might have immutable Headers
// so we should clone them before trying to mutate them
response = new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers: new Headers(response.headers)
}); @Conduitry Any suggestions on how to improve the documentation? Maybe provide an example other than After-all, it is just a server handle function example code. |
Co-authored-by: Simon H <[email protected]>
preview: https://svelte-dev-git-preview-kit-12543-svelte.vercel.app/ this is an automated message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Fixes #11883. Stumbled on it again after 5 months.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.Edits