-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Astro Info
Astro v4.0.6
Node v18.18.0
System Linux (x64)
Package Manager npm
Output static
Adapter none
Integrations none
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
When submitting a form with method="POST" with the <ViewTransitions /> component, Astro submits the form as Content-Type: multipart/form-data, whereas the browser default behavior without JavaScript is to submit as Content-Type: application/x-www-form-urlencoded.
In the linked repo, I have the server log out await Astro.request.text() on the server side. It looks like this:
When you disable JavaScript, or just do this same thing on a non-astro project, the log looks like this:
See also the request header with JavaScript enabled:
Vs JavaScript disabled:
What's the expected result?
The ViewTransitions progressive enhancement should submit forms as Content-Type: application/x-www-form-urlencoded.
Here is where Remix handles this in their codebase: https://github.com/remix-run/remix/blob/e26ddc724e78b9cf48110cd4f854516a7f1a87a2/packages/remix-react/data.ts#L95
Note that it might be hard to disable JavaScript while using StackBlitz. The easiest way to reproduce this bug is to clone the repo locally: https://github.com/knpwrs/astro-view-transition-post-bug
Link to Minimal Reproducible Example
https://stackblitz.com/~/github.com/knpwrs/astro-view-transition-post-bug
Participation
- I am willing to submit a pull request for this issue.