Relative Content

Tag Archive for javascripttypescriptastrojs

Content-Type was not one of “multipart/form-data” or “application/x-www-form-urlencoded”

I am attempting to build a static site with Astro, but I want to add a component that allows a user to sign up for a newsletter via an HTML form. Following Astro’s guides, I am using an API endpoint to accept the form data and process the logic. However, when submitting the form, I get an error, Content-Type was not one of "multipart/form-data" or "application/x-www-form-urlencoded" when calling await request.formData();. As far as I can see by looking at the headers in the request though, it is encoded as multipart/form-data: