-
Notifications
You must be signed in to change notification settings - Fork 2
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
chore: add support to multiple HTTP response status codes π§βπ» #16
base: main
Are you sure you want to change the base?
Conversation
Can any of the maintainers take a look at this? @rafaelpadovezi, @willianantunes, @ricardochaves |
Maybe switching to codecov can be an option. They have an |
Thanks for the suggestion @luizhlelis, we will take a look at |
Thank you @rafaelpadovezi. The PR is now |
@@ -25,7 +25,7 @@ public async Task OnActionExecutionAsync_ControllerDoesNotHaveApiControllerAttri | |||
|
|||
// Act | |||
var response = | |||
await Client.PostAsJsonAsync($"{ControllerWithoutApiAttributeEndpoint}/test-validator", payload); | |||
await HttpClientJsonExtensions.PostAsJsonAsync(Client, $"{ControllerWithoutApiAttributeEndpoint}/test-validator", payload); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: It's realy a minor issue, but I didn't understand why changing the call to PostAsJsonAsync
this way. Client.PostAsJsonAsync
stopped working? If our custom extension is causing problems I think it's better to remove it since we don't need it anymore.
{ | ||
if (item is null) | ||
continue; | ||
var context = new ValidationContext<object>(item); | ||
var result = await validator.ValidateAsync(context); | ||
|
||
result.AddToModelState(modelState, string.Empty); | ||
var errorCode = result.Errors?.FirstOrDefault()?.ErrorCode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: The order of the error entries affects the result? If the first validation that fails is a "normal" one and the second one has an .WithErrorCode(ErrorCode.Forbidden);
what would be the the error code?
If so, maybe we should add this info to the README
Summary
Add support to multiple HTTP response status codes π§βπ»
Fixes #8