Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable ConfigureHttpClientDefaults() #2157

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ public static class HttpServiceCollectionExtensions
public static IServiceCollection AddHttpClients(this IServiceCollection services)
{
services.AddHttpClient()
.ConfigureHttpClientDefaults((p) => p.ApplyDefaultConfiguration());
.AddHttpClient(string.Empty)
.ApplyDefaultConfiguration();

//// TODO Re-enable when fixed in .NET 8.0.2
////.ConfigureHttpClientDefaults((p) => p.ApplyDefaultConfiguration());

using var serviceProvider = services.BuildServiceProvider();
var options = serviceProvider.GetRequiredService<SiteOptions>();
Expand All @@ -31,14 +35,15 @@ public static IServiceCollection AddHttpClients(this IServiceCollection services
foreach (string name in providers.Keys)
{
services.AddHttpClient(name)
.ApplyDefaultConfiguration()
.ApplyRemoteAuthenticationConfiguration();
}
}

services.AddHttpClient<ITflService, TflService>("TfL", (provider, client) =>
{
client.BaseAddress = provider.GetRequiredService<TflOptions>().BaseUri;
});
}).ApplyDefaultConfiguration();

return services;
}
Expand Down
Loading