Browse Source

Fix issue with Status set when items list is empty

pull/1304/head
Dmytro Hridin 4 years ago
parent
commit
5aa9e02ef2
1 changed files with 4 additions and 5 deletions
  1. +4
    -5
      src/Services/Catalog/Catalog.API/Grpc/CatalogService.cs

+ 4
- 5
src/Services/Catalog/Catalog.API/Grpc/CatalogService.cs View File

@ -68,11 +68,10 @@ namespace Catalog.API.Grpc
{
var items = await GetItemsByIdsAsync(request.Ids);
if (!items.Any())
{
context.Status = new Status(StatusCode.NotFound, $"ids value invalid. Must be comma-separated list of numbers");
}
context.Status = new Status(StatusCode.OK, string.Empty);
context.Status = !items.Any() ?
new Status(StatusCode.NotFound, $"ids value invalid. Must be comma-separated list of numbers") :
new Status(StatusCode.OK, string.Empty);
return this.MapToResponse(items);
}


Loading…
Cancel
Save