-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
ETag generation throws on binary responses since 1.0.0-next.82 #1136
Comments
intrikate
changed the title
Unable to set content-type for binary response in endpoint
ETag generation throws on binary responses since 1.0.0-next.82
Apr 20, 2021
More context: kit/packages/kit/src/runtime/server/index.js Lines 82 to 87 in e6f8098
|
This was referenced Apr 22, 2021
5 tasks
Rich-Harris
added a commit
that referenced
this issue
May 7, 2021
5 tasks
Rich-Harris
pushed a commit
that referenced
this issue
May 9, 2021
* incoming rawBody is string or Uint8Array * make body types stricter * add etag tests * generate etags for binary bodies - fixes #1136 * oops * rawBody is a Uint8Array * changesets * use shared hash helper
Did #1382 actually solve this? Unless I've missed something the changes actually prevent serving binary images in the way the example repo does. |
You’re right, it effectively kills binary endpoints, with one small exception. Is this really necessary? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Since
1.0.0-next.82
, attempting to set aContent-Type
header for certain binary responses in endpoint handlers will throw an exception:str.charCodeAt is not a function
. Responding with no type or with explicitapplication/json
won’t throw. Downgrading tonext.81
fixes the issue. Upgrading tonext.83
does not.Update: This appears to be a regression introduced with the new ETag generation in #1117.
To Reproduce
Make an endpoint that responds with e.g. a JPEG with the
Content-Type
(orcontent-type
) header set toimage/jpeg
.See repo: https://github.com/intrikate/sveltekit-jpeg-endpoint-issue
Expected behavior
Content-Type
set, the body sent, no exceptions thrown. Essentially what1.0.0-next.81
does.Stacktraces
Stack trace
Information about your SvelteKit Installation:
Diagnostics
Severity
Pretty high, especially if this is indeed a regression.Because nobody else seems to be affected, and the entire hashing business may currently be circumvented with
cache-control
, I’m inclined to downgrade severity to low.The text was updated successfully, but these errors were encountered: