From 3b4256fcedac55c3df7dc1aec5cccb58127f50c2 Mon Sep 17 00:00:00 2001 From: Viswanatha Swamy Date: Fri, 1 Jan 2021 20:37:38 +0530 Subject: [PATCH 1/6] Update Startup.cs --- src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs index 1ea6c0f4f1..243e3a01e8 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs @@ -63,7 +63,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerF { app.UseDeveloperExceptionPage(); } - + app.UseHttpsRedirection(); app.UseSwagger().UseSwaggerUI(c => From 640600fd5509e24f7e19ff4643148b41d7bb4876 Mon Sep 17 00:00:00 2001 From: Viswanatha Swamy Date: Fri, 1 Jan 2021 20:38:48 +0530 Subject: [PATCH 2/6] Removed commented code --- .../aggregator/Services/GrpcCallerService.cs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/GrpcCallerService.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/GrpcCallerService.cs index 2039c7c4f2..83ecd95f2a 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/GrpcCallerService.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/GrpcCallerService.cs @@ -15,15 +15,6 @@ public static async Task CallService(string urlGrpc, Func< var channel = GrpcChannel.ForAddress(urlGrpc); - /* - using var httpClientHandler = new HttpClientHandler - { - ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; } - }; - - */ - - Log.Information("Creating grpc client base address urlGrpc ={@urlGrpc}, BaseAddress={@BaseAddress} ", urlGrpc, channel.Target); try @@ -49,13 +40,6 @@ public static async Task CallService(string urlGrpc, Func fun AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2Support", true); - /* - using var httpClientHandler = new HttpClientHandler - { - ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; } - }; - */ - var channel = GrpcChannel.ForAddress(urlGrpc); Log.Debug("Creating grpc client base address {@httpClient.BaseAddress} ", channel.Target); From 42a541fa2dc26f247e41848d7c69847703099807 Mon Sep 17 00:00:00 2001 From: Viswanatha Swamy Date: Fri, 1 Jan 2021 20:41:11 +0530 Subject: [PATCH 3/6] Update UrlsConfig.cs --- .../Web.Bff.Shopping/aggregator/Config/UrlsConfig.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Config/UrlsConfig.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Config/UrlsConfig.cs index b16530e1bc..b19874aac8 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Config/UrlsConfig.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Config/UrlsConfig.cs @@ -20,7 +20,7 @@ public class CatalogOperations public class BasketOperations { public static string GetItemById(string id) => $"/api/v1/basket/{id}"; - + public static string UpdateBasket() => "/api/v1/basket"; } From d3a65566a4ec202cded4f28565eec66c2ab6831c Mon Sep 17 00:00:00 2001 From: Viswanatha Swamy Date: Fri, 1 Jan 2021 20:52:29 +0530 Subject: [PATCH 4/6] Small Refactoring --- .../Mobile.Bff.Shopping/aggregator/Services/BasketService.cs | 2 +- .../Mobile.Bff.Shopping/aggregator/Services/CatalogService.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/BasketService.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/BasketService.cs index 8bd4c8948e..b4cf4c4176 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/BasketService.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/BasketService.cs @@ -27,7 +27,7 @@ public async Task GetById(string id) { return await GrpcCallerService.CallService(_urls.GrpcBasket, async channel => { - + var client = new Basket.BasketClient(channel); _logger.LogDebug("grpc client created, request = {@id}", id); var response = await client.GetBasketByIdAsync(new BasketRequest { Id = id }); diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/CatalogService.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/CatalogService.cs index f98b909895..2257b408a3 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/CatalogService.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/CatalogService.cs @@ -36,7 +36,7 @@ public async Task GetCatalogItemAsync(int id) public async Task> GetCatalogItemsAsync(IEnumerable ids) { - return await GrpcCallerService.CallService(_urls.GrpcCatalog, async channel=> + return await GrpcCallerService.CallService(_urls.GrpcCatalog, async channel => { var client = new CatalogClient(channel); var request = new CatalogItemsRequest { Ids = string.Join(",", ids), PageIndex = 1, PageSize = 10 }; From e144a687b9977629832bddae69224c848713fbab Mon Sep 17 00:00:00 2001 From: Viswanatha Swamy Date: Fri, 1 Jan 2021 20:53:09 +0530 Subject: [PATCH 5/6] Removed Commented Code --- .../aggregator/Services/GrpcCallerService.cs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/GrpcCallerService.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/GrpcCallerService.cs index 55f3df3ee7..0160a78738 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/GrpcCallerService.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Services/GrpcCallerService.cs @@ -15,15 +15,6 @@ public static async Task CallService(string urlGrpc, Func< var channel = GrpcChannel.ForAddress(urlGrpc); - /* - using var httpClientHandler = new HttpClientHandler - { - ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; } - }; - - */ - - Log.Information("Creating grpc client base address urlGrpc ={@urlGrpc}, BaseAddress={@BaseAddress} ", urlGrpc, channel.Target); try @@ -47,13 +38,6 @@ public static async Task CallService(string urlGrpc, Func fun AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2Support", true); - /* - using var httpClientHandler = new HttpClientHandler - { - ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; } - }; - */ - var channel = GrpcChannel.ForAddress(urlGrpc); Log.Debug("Creating grpc client base address {@httpClient.BaseAddress} ", channel.Target); From 477720b6234fab9189ddc398190d59688bf9d08e Mon Sep 17 00:00:00 2001 From: Viswanatha Swamy Date: Fri, 1 Jan 2021 20:58:11 +0530 Subject: [PATCH 6/6] Small Refactoring --- .../Mobile.Bff.Shopping/aggregator/Models/OrderData.cs | 2 +- .../aggregator/Models/UpdateBasketItemsRequest.cs | 2 +- .../aggregator/Models/UpdateBasketRequest.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/OrderData.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/OrderData.cs index 44749ff6cb..3ecddcf361 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/OrderData.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/OrderData.cs @@ -42,7 +42,7 @@ public class OrderData public string Buyer { get; set; } - public List OrderItems { get; } = new List(); + public List OrderItems { get; } = new List(); } } diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketItemsRequest.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketItemsRequest.cs index c5a6ccb3ef..066f01a9cf 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketItemsRequest.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketItemsRequest.cs @@ -5,7 +5,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models public class UpdateBasketItemsRequest { - + public string BasketId { get; set; } public ICollection Updates { get; set; } diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketRequest.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketRequest.cs index a1c2555519..f8fb7eb03b 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketRequest.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/UpdateBasketRequest.cs @@ -2,7 +2,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models { - + public class UpdateBasketRequest { public string BuyerId { get; set; }