-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add a warning when using encoding
in SSR and headers
on objects in endpoints
#6358
Conversation
🦋 Changeset detectedLatest commit: 1946122 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Just a nitpick suggestion
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
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.
Should account for prerender
as well
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.
The check should apply to both headers
and encoding
I think?
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.
Looks great!
Changes
Title is a mouthful. Basically,
encoding
is only used to write the files when doing static generation, as such in SSR it doesn't do anything, but people expect it to affect the charset, but since #3841 we always default tocharset=utf-8
. In the future, it would be much better if we only returned responses...The warning for headers is because returning an object with a certain type of body trips up TypeScript into thinking you're returning a Response since they're "compatible", so a small warning will help nudge users in the right direction.
Close #3841
Testing
N/A. Tested the warning manually
Docs
N/A