used framework provides extension method to add IHttpContextAccessor in the DI container

This commit is contained in:
rafsanulhasan 2018-08-14 05:24:12 +06:00
parent e70b2b2950
commit 23d3e60c9e

View File

@ -1,7 +1,6 @@
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Filters.Basket.API.Infrastructure.Filters;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Infrastructure;
@ -145,7 +144,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
{
//register delegating handlers
services.AddTransient<HttpClientAuthorizationDelegatingHandler>();
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddHttpContextAccessor();
//register http services
services.AddHttpClient<IBasketService, BasketService>()