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

Add support to multiple HTTP response status codes #8

Open
luizhlelis opened this issue Oct 3, 2022 · 0 comments · May be fixed by #16
Open

Add support to multiple HTTP response status codes #8

luizhlelis opened this issue Oct 3, 2022 · 0 comments · May be fixed by #16
Labels
good first issue Good for newcomers hacktoberfest-accepted Participants in Hacktoberfest are welcome to contribute help wanted Good for community contributors to help [up-for-grabs]

Comments

@luizhlelis
Copy link
Contributor

Context

Currently, the library supports only 400 BadRequest status code when an error occurs in a validation.

What should be done

Use fluentvalidation custom error codes to build at least three different error codes (beyond BadRequest):

  • 404 NotFound (code = "NOT_FOUND_ERROR")
  • 403 Forbidden (code = "FORBIDDEN_ERROR")
  • 401 Unauthorized (code = "UNAUTHORIZED_ERROR")

You can follow this example from another repo that uses something very similar. The status code is checked in the ModelStateAsyncFilter and the validator must contain WithErrorCode extension method when error code is different from BadRequest.

@luizhlelis luizhlelis added good first issue Good for newcomers help wanted Good for community contributors to help [up-for-grabs] hacktoberfest-accepted Participants in Hacktoberfest are welcome to contribute labels Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers hacktoberfest-accepted Participants in Hacktoberfest are welcome to contribute help wanted Good for community contributors to help [up-for-grabs]
Projects
None yet
1 participant