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

Overriding http return stats on exception #6

Closed
jhoover4 opened this issue Jul 17, 2020 · 4 comments · Fixed by #8
Closed

Overriding http return stats on exception #6

jhoover4 opened this issue Jul 17, 2020 · 4 comments · Fixed by #8

Comments

@jhoover4
Copy link

I notice that you can update the returned status on success, but can you do the same thing on error? We typically use 422s instead of 400s for malformed requests.

Thanks!

@bauerji
Copy link
Owner

bauerji commented Jul 19, 2020

Hi,

it is not possible yet. But I think this would be a good new feature. I will add the possibility to modify status code when ValidationError occurs using flask app config value FLASK_PYDANTIC_VALIDATION_ERROR_STATUS_CODE.

Does this solve your problem?

Jirka

@jhoover4
Copy link
Author

Hey thanks for responding so quickly to this! I was thinking maybe something in the decorator itself? A config value like this could also work though

@bauerji
Copy link
Owner

bauerji commented Jul 20, 2020

Fine, it's released in version 0.0.7. Feel free to reopen or create another issue if you wished to use more adjustable way (such as decorator parameter etc.)

@jhoover4
Copy link
Author

Okay I'll see if this works for now. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants