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)
Describe the problem
When using
<form use:enhance>to send an enhanced form action request, client-sidefetchis used to request data from SvelteKit that currently is always returned with status code200even whenreturn 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 {}(200or204), or match the status code returned fromfail().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.statusinuse:enhance.Importance
would make my life easier
Additional Information
Continued from: #7233 (comment)