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

Don't set application/json Content-Type on FormData bodies #1053

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

macleodmac
Copy link
Contributor

Fixes #1052

@encore-cla
Copy link

encore-cla bot commented Feb 28, 2024

All committers have signed the CLA.

Copy link
Member

@eandre eandre left a comment

Choose a reason for hiding this comment

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

Thanks @macleodmac! One comment that would be good to address; what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe a better approach altogether is to drop the this.headers on the client altogether, and simply have each
endpoint add its own headers. The endpoint is the thing that knows how the body should be encoded, so it probably makes more sense to do it there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we'd still need this.headers in order to manage things like user agent.

The tricky thing with managing this on a per endpoint basis is that application/json is a sensible default, and the desired behaviour is that the Content-Type header is unset, rather than overridden, as setting the boundary happens at the fetch level, so even if setting the headers was moved to the endpoint, there would still be an issue.

Keen to hear your thoughts though, I may be missing the mark!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants