Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Swamy/01jan2021-small-refactoring (#1570)
Browse files Browse the repository at this point in the history
* Update Startup.cs

* Removed commented code

* Update UrlsConfig.cs

* Small Refactoring

* Removed Commented Code

* Small Refactoring
  • Loading branch information
vishipayyallore authored Jan 4, 2021
1 parent 600d0aa commit 6f8f247
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class OrderData

public string Buyer { get; set; }

public List<OrderItemData> OrderItems { get; } = new List<OrderItemData>();
public List<OrderItemData> OrderItems { get; } = new List<OrderItemData>();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models

public class UpdateBasketItemsRequest
{

public string BasketId { get; set; }

public ICollection<UpdateBasketItemData> Updates { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
{

public class UpdateBasketRequest
{
public string BuyerId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public async Task<BasketData> 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 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public async Task<CatalogItem> GetCatalogItemAsync(int id)
public async Task<IEnumerable<CatalogItem>> GetCatalogItemsAsync(IEnumerable<int> 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 };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ public static async Task<TResponse> CallService<TResponse>(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
Expand All @@ -47,13 +38,6 @@ public static async Task CallService(string urlGrpc, Func<GrpcChannel, Task> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ public static async Task<TResponse> CallService<TResponse>(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
Expand All @@ -49,13 +40,6 @@ public static async Task CallService(string urlGrpc, Func<GrpcChannel, Task> 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);
Expand Down
2 changes: 1 addition & 1 deletion src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerF
{
app.UseDeveloperExceptionPage();
}

app.UseHttpsRedirection();

app.UseSwagger().UseSwaggerUI(c =>
Expand Down

1 comment on commit 6f8f247

@william-keller
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great

Please sign in to comment.