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

Have enhanced form action responses use HTTP status codes returned from fail #12934

Open
theetrain opened this issue Nov 1, 2024 · 0 comments
Labels
breaking change forms Stuff relating to forms and form actions
Milestone

Comments

@theetrain
Copy link
Contributor

theetrain commented Nov 1, 2024

Describe the problem

When using <form use:enhance> to send an enhanced form action request, client-side fetch is used to request data from SvelteKit that currently is always returned with status code 200 even when return fail(400, {}) is used.

This is problematic when trying to track responses with a status of 400 (for example) using observability tools like Sentry.

Describe the proposed solution

Have the HTTP status code in a form action response match the status code of either return {} (200 or 204), or match the status code returned from fail().

This way, I can more easily track which user received which status code using observability tools. Due to the change in behaviour, I'd consider this a breaking change to SvelteKit if we proceed.

Alternatives considered

Manually log responses client-side based on response.status in use:enhance.

Importance

would make my life easier

Additional Information

Continued from: #7233 (comment)

@benmccann benmccann added this to the 3.0 milestone Nov 1, 2024
@eltigerchino eltigerchino added breaking change forms Stuff relating to forms and form actions labels Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change forms Stuff relating to forms and form actions
Projects
None yet
Development

No branches or pull requests

3 participants