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

Actions expect form-encoded data (received application/json) error in SvelteKit form handler #22

Closed
danawoodman opened this issue Oct 12, 2022 · 3 comments

Comments

@danawoodman
Copy link
Collaborator

With v0.6.1 itty-fetcher does not appear to work with form actions. POSTing setting value as JSON for some inexplicable reason.

const data = new FormData();
data.set("file", new File(["hi"], "foo.txt"));
fetcher()
	.post("/preview?/upload", data)
	.then(console.log)
	.catch(console.error);

Fails with Actions expect form-encoded data (received application/json)

@danawoodman
Copy link
Collaborator Author

Believe this is because the content-type header is set to application/json

@kwhitley
Copy link
Owner

Wait, did you try 0.7.0 after my changes?

@danawoodman
Copy link
Collaborator Author

Why would the Blob change affect the form content type?

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

No branches or pull requests

2 participants