-
Notifications
You must be signed in to change notification settings - Fork 279
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
Request validation and http error aborting #933
Comments
It seems |
So, I've been playing around with this but it seems the error system leaves a bit to be desired.
Now, before I put in the time to do this, I'd like to make sure you're interested. |
@Ken-vdE thanks for this! I went over the thread and reasoning -- it looks solid. please feel free to go ahead and submit a PR for us to go over |
this made actionable in this ticket: #1097 |
I think I can keep this question short.
Maybe I'm missing something, but it seems there is no out-of-the box way to validate incoming requests.
The only thing I can find regarding validation is model-validation, but not request validation.
There is the JsonRejection error that's thrown (when the Json does not comply with the struct used in the controller) which is returned to the user as 400 "Bad Request".
It feels like src/controller/mod.rs#L185 is missing a 422 ValidationError case as well as a few other http errors.
Am I missing something? Is there a way to validate request data and is there a way to abort into other http errors from the controller (like 403 forbidden or even just a 201 no content)?
The text was updated successfully, but these errors were encountered: