Category:Nintendo Entertainment System games
Category:Mario Party
Category:Party video games
Category:Video games developed in Japan
Category:Wii games
Category:Wii-only games
Category:Wii games re-released on the Nintendo eShopQ:
ASP.NET Core: How to prevent the httpclient from sending Authorization header in all the requests
I'm using the
System.Net.Http.HttpClientFactory
to create http clients, in order to avoid request caching for every request. This works fine. However, the created clients also send an Authorization header to every request:
Authorization: Bearer [some random access token]
What I want to achieve is to prevent this header from being sent when the client is created, but keep the ability to add it manually later. I don't want it to be added automatically, only when the client is created. The reason is that I'm creating the clients in a separate class and send the requests via IHostedService.
The class which creates the clients is declared like this:
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.Configure(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddMvc();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseMvc();
}
}
Then the actual code which creates the clients is in a method which is called every time I have to create a client: ac619d1d87
Related links:
Comments