Should "Actions expect form-encoded data" not return http status code 400? #11248
Unanswered
alexbjorlig
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Hi Alex. That sounds like a great idea. I think the http status code 415 is fitting. I've created an issue for this from this discussion #11251 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If you POST JSON to a form action, sveltekit will throw
Actions expect form-encoded data (received application/json)
.This will then bubble to
HandleServerError
, and result in an Error with HTTP status code 500.I think it would be better if the error was either 415 or 400.
One of the issues with the current implementation is that if you report to Sentry in the error handler, you will report an error when people submit wrong data (something that will create a lot of noise in Sentry). Better to reserve HTTP 500 for situations where we don't have better.
I might be missing something. If not, then I would be happy to submit a PR.
Beta Was this translation helpful? Give feedback.
All reactions