From 5aa9e02ef28c7c9473fca286932e13634862ec07 Mon Sep 17 00:00:00 2001 From: Dmytro Hridin Date: Sat, 18 Apr 2020 19:37:17 +0300 Subject: [PATCH] Fix issue with Status set when items list is empty --- src/Services/Catalog/Catalog.API/Grpc/CatalogService.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Services/Catalog/Catalog.API/Grpc/CatalogService.cs b/src/Services/Catalog/Catalog.API/Grpc/CatalogService.cs index 13c7c8d2e..4032422d7 100644 --- a/src/Services/Catalog/Catalog.API/Grpc/CatalogService.cs +++ b/src/Services/Catalog/Catalog.API/Grpc/CatalogService.cs @@ -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); }