mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
fix(dir): 🐛 support async ValidatorPipelineBehavior validations
This commit is contained in:
parent
0ad50629d5
commit
51feda8b79
1 changed files with 3 additions and 7 deletions
|
|
@ -13,15 +13,11 @@ public ValidatorPipelineBehavior(IEnumerable<IValidator<TRequest>> validators)
|
|||
_validators = validators;
|
||||
}
|
||||
|
||||
public Task<TResponse> Handle(TRequest request,
|
||||
public async Task<TResponse> Handle(TRequest request,
|
||||
CancellationToken cancellationToken,
|
||||
RequestHandlerDelegate<TResponse> next)
|
||||
{
|
||||
foreach (var validator in _validators)
|
||||
{
|
||||
validator.ValidateAndThrow(request);
|
||||
}
|
||||
|
||||
return next();
|
||||
await Task.WhenAll(_validators.Select(v => v.ValidateAndThrowAsync(request, cancellationToken)));
|
||||
return await next();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue