Skip to content
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

[fix] Expand list of allowed mime types for binary bodies #1687

Merged
merged 21 commits into from
Jul 12, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/kit/src/runtime/server/endpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ export default async function render_route(request, route) {
if (
typeof body === 'object' &&
!(body instanceof Uint8Array) &&
(!type || type === 'application/json')
(!type || type === 'application/json' || type === 'application/json; charset=utf-8')
Copy link
Contributor Author

@JeanJPNM JeanJPNM Jul 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use type.startsWith('application/json') since the presence (or absence) of the encoding does not change the behavior of the code

) {
headers = { ...headers, 'content-type': 'application/json' };
headers = { ...headers, 'content-type': 'application/json; charset=utf-8' };
normalized_body = JSON.stringify(body);
} else {
normalized_body = /** @type {import('types/hooks').StrictBody} */ (body);
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.