Merge 07140142fb
into 086fbd49cf
commit
44936df648
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
|
||||
namespace MediaBrowser.Common.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// Extensions for <see cref="IServiceProvider"/>.
|
||||
/// </summary>
|
||||
public static class HttpClientFactoryExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Get a plugin-configured HttpClient.
|
||||
/// This requires calling <c>AddHttpClient{T}</c> during <c>RegisterServices</c>.
|
||||
/// </summary>
|
||||
/// <param name="httpClientFactory">The http client factory.</param>
|
||||
/// <typeparam name="T">The type of plugin.</typeparam>
|
||||
/// <returns>The HttpClient.</returns>
|
||||
public static HttpClient GetPluginHttpClient<T>(this IHttpClientFactory httpClientFactory)
|
||||
where T : BasePlugin
|
||||
=> httpClientFactory.CreateClient(typeof(T).Name);
|
||||
}
|
@ -1,28 +1,17 @@
|
||||
namespace MediaBrowser.Common.Net
|
||||
namespace MediaBrowser.Common.Net;
|
||||
|
||||
/// <summary>
|
||||
/// Registered http client names.
|
||||
/// </summary>
|
||||
public static class NamedClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Registered http client names.
|
||||
/// Gets the value for the default named http client which implements happy eyeballs.
|
||||
/// </summary>
|
||||
public static class NamedClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the value for the default named http client which implements happy eyeballs.
|
||||
/// </summary>
|
||||
public const string Default = nameof(Default);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value for the MusicBrainz named http client.
|
||||
/// </summary>
|
||||
public const string MusicBrainz = nameof(MusicBrainz);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value for the DLNA named http client.
|
||||
/// </summary>
|
||||
public const string Dlna = nameof(Dlna);
|
||||
public const string Default = nameof(Default);
|
||||
|
||||
/// <summary>
|
||||
/// Non happy eyeballs implementation.
|
||||
/// </summary>
|
||||
public const string DirectIp = nameof(DirectIp);
|
||||
}
|
||||
/// <summary>
|
||||
/// Non happy eyeballs implementation.
|
||||
/// </summary>
|
||||
public const string DirectIp = nameof(DirectIp);
|
||||
}
|
||||
|
Loading…
Reference in new issue