1 implementation of IHttpClientBuilder
Microsoft.Extensions.Http (1)
DependencyInjection\DefaultHttpClientBuilder.cs (1)
9
internal sealed class DefaultHttpClientBuilder :
IHttpClientBuilder
197 references to IHttpClientBuilder
Microsoft.AspNetCore.HeaderPropagation (9)
DependencyInjection\HeaderPropagationHttpClientBuilderExtensions.cs (9)
10
/// <see cref="
IHttpClientBuilder
"/> extension methods for <see cref="HeaderPropagationMiddleware"/> which propagates request headers to an <see cref="System.Net.Http.HttpClient"/>.
20
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/> to add the message handler to.</param>
21
/// <returns>The <see cref="
IHttpClientBuilder
"/> so that additional calls can be chained.</returns>
22
public static
IHttpClientBuilder
AddHeaderPropagation(this
IHttpClientBuilder
builder)
48
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/> to add the message handler to.</param>
50
/// <returns>The <see cref="
IHttpClientBuilder
"/> so that additional calls can be chained.</returns>
51
public static
IHttpClientBuilder
AddHeaderPropagation(this
IHttpClientBuilder
builder, Action<HeaderPropagationMessageHandlerOptions> configure)
Microsoft.AspNetCore.HeaderPropagation.Tests (1)
HeaderPropagationIntegrationTest.cs (1)
209
var
client = services.AddHttpClient("example.com", c => c.BaseAddress = new Uri("http://example.com"))
Microsoft.Extensions.Http (156)
DependencyInjection\HttpClientBuilderExtensions.cs (98)
18
/// Extension methods for configuring an <see cref="
IHttpClientBuilder
"/>
25
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
27
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
28
public static
IHttpClientBuilder
ConfigureHttpClient(this
IHttpClientBuilder
builder, Action<HttpClient> configureClient)
41
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
43
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
48
public static
IHttpClientBuilder
ConfigureHttpClient(this
IHttpClientBuilder
builder, Action<IServiceProvider, HttpClient> configureClient)
67
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
69
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
74
public static
IHttpClientBuilder
AddHttpMessageHandler(this
IHttpClientBuilder
builder, Func<DelegatingHandler> configureHandler)
90
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
91
/// <param name="configureHandler">A delegate that is used to create a <see cref="DelegatingHandler"/>.</param> /// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
102
public static
IHttpClientBuilder
AddHttpMessageHandler(this
IHttpClientBuilder
builder, Func<IServiceProvider, DelegatingHandler> configureHandler)
118
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
119
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
129
public static
IHttpClientBuilder
AddHttpMessageHandler<THandler>(this
IHttpClientBuilder
builder)
146
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
148
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
153
public static
IHttpClientBuilder
ConfigurePrimaryHttpMessageHandler(this
IHttpClientBuilder
builder, Func<HttpMessageHandler> configureHandler)
170
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
172
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
183
public static
IHttpClientBuilder
ConfigurePrimaryHttpMessageHandler(this
IHttpClientBuilder
builder, Func<IServiceProvider, HttpMessageHandler> configureHandler)
200
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
201
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
211
public static
IHttpClientBuilder
ConfigurePrimaryHttpMessageHandler<THandler>(this
IHttpClientBuilder
builder)
228
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
230
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
237
public static
IHttpClientBuilder
ConfigurePrimaryHttpMessageHandler(this
IHttpClientBuilder
builder, Action<HttpMessageHandler, IServiceProvider> configureHandler)
254
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
256
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
258
public static
IHttpClientBuilder
ConfigureHttpMessageHandlerBuilder(this
IHttpClientBuilder
builder, Action<HttpMessageHandlerBuilder> configureBuilder)
273
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
275
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
279
/// <see cref="ConfigurePrimaryHttpMessageHandler(
IHttpClientBuilder
, Func{HttpMessageHandler})"/> or
280
/// <see cref="UseSocketsHttpHandler(
IHttpClientBuilder
, Action{ISocketsHttpHandlerBuilder})"/>, then the passed <paramref name="configureHandler"/>
285
public static
IHttpClientBuilder
UseSocketsHttpHandler(this
IHttpClientBuilder
builder, Action<SocketsHttpHandler, IServiceProvider>? configureHandler = null)
309
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
312
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
316
/// <see cref="ConfigurePrimaryHttpMessageHandler(
IHttpClientBuilder
, Func{HttpMessageHandler})"/> or
317
/// <see cref="UseSocketsHttpHandler(
IHttpClientBuilder
, Action{ISocketsHttpHandlerBuilder})"/>, then the configuration set on
323
public static
IHttpClientBuilder
UseSocketsHttpHandler(this
IHttpClientBuilder
builder, Action<ISocketsHttpHandlerBuilder> configureBuilder)
336
/// associated with the <see cref="
IHttpClientBuilder
"/>.
342
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
350
/// Calling <see cref="HttpClientBuilderExtensions.AddTypedClient{TClient}(
IHttpClientBuilder
)"/> will register a typed
359
public static
IHttpClientBuilder
AddTypedClient<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TClient>(
360
this
IHttpClientBuilder
builder)
368
internal static
IHttpClientBuilder
AddTypedClientCore<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TClient>(
369
this
IHttpClientBuilder
builder, bool validateSingleType)
386
private static TClient AddTransientHelper<TClient>(IServiceProvider s,
IHttpClientBuilder
builder) where TClient : class
397
/// associated with the <see cref="
IHttpClientBuilder
"/>. The created instances will be of type
408
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
416
/// Calling <see cref="HttpClientBuilderExtensions.AddTypedClient{TClient,TImplementation}(
IHttpClientBuilder
)"/>
426
public static
IHttpClientBuilder
AddTypedClient<TClient, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(
427
this
IHttpClientBuilder
builder)
436
internal static
IHttpClientBuilder
AddTypedClientCore<TClient, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(
437
this
IHttpClientBuilder
builder, bool validateSingleType)
450
private static TClient AddTransientHelper<TClient, TImplementation>(IServiceProvider s,
IHttpClientBuilder
builder) where TClient : class where TImplementation : class, TClient
461
/// associated with the <see cref="
IHttpClientBuilder
"/>.
467
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
476
/// Calling <see cref="HttpClientBuilderExtensions.AddTypedClient{TClient}(
IHttpClientBuilder
,Func{HttpClient,TClient})"/>
480
public static
IHttpClientBuilder
AddTypedClient<TClient>(this
IHttpClientBuilder
builder, Func<HttpClient, TClient> factory)
489
internal static
IHttpClientBuilder
AddTypedClientCore<TClient>(this
IHttpClientBuilder
builder, Func<HttpClient, TClient> factory, bool validateSingleType)
507
/// associated with the <see cref="
IHttpClientBuilder
"/>.
513
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
522
/// Calling <see cref="HttpClientBuilderExtensions.AddTypedClient{TClient}(
IHttpClientBuilder
,Func{HttpClient,IServiceProvider,TClient})"/>
526
public static
IHttpClientBuilder
AddTypedClient<TClient>(this
IHttpClientBuilder
builder, Func<HttpClient, IServiceProvider, TClient> factory)
535
internal static
IHttpClientBuilder
AddTypedClientCore<TClient>(this
IHttpClientBuilder
builder, Func<HttpClient, IServiceProvider, TClient> factory, bool validateSingleType)
557
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
559
/// <returns>The <see cref="
IHttpClientBuilder
"/>.</returns>
562
public static
IHttpClientBuilder
RedactLoggedHeaders(this
IHttpClientBuilder
builder, Func<string, bool> shouldRedactHeaderValue)
578
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
580
/// <returns>The <see cref="
IHttpClientBuilder
"/>.</returns>
581
public static
IHttpClientBuilder
RedactLoggedHeaders(this
IHttpClientBuilder
builder, IEnumerable<string> redactedLoggedHeaderNames)
620
public static
IHttpClientBuilder
SetHandlerLifetime(this
IHttpClientBuilder
builder, TimeSpan handlerLifetime)
637
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
639
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
640
public static
IHttpClientBuilder
ConfigureAdditionalHttpMessageHandlers(this
IHttpClientBuilder
builder, Action<IList<DelegatingHandler>, IServiceProvider> configureAdditionalHandlers)
654
private static void ReserveClient(
IHttpClientBuilder
builder, Type type, string name, bool validateSingleType)
DependencyInjection\HttpClientBuilderExtensions.Logging.cs (16)
16
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
21
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
46
public static
IHttpClientBuilder
AddLogger(this
IHttpClientBuilder
builder, Func<IServiceProvider, IHttpClientLogger> httpClientLoggerFactory, bool wrapHandlersPipeline = false)
76
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
79
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
108
public static
IHttpClientBuilder
AddLogger<TLogger>(this
IHttpClientBuilder
builder, bool wrapHandlersPipeline = false)
119
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
120
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
121
public static
IHttpClientBuilder
RemoveAllLoggers(this
IHttpClientBuilder
builder)
137
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
138
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
139
public static
IHttpClientBuilder
AddDefaultLogger(this
IHttpClientBuilder
builder)
DependencyInjection\HttpClientFactoryServiceCollectionExtensions.cs (40)
78
/// <param name="configure">A delegate that is used to configure an <see cref="
IHttpClientBuilder
"/>.</param>
80
public static IServiceCollection ConfigureHttpClientDefaults(this IServiceCollection services, Action<
IHttpClientBuilder
> configure)
98
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
108
public static
IHttpClientBuilder
AddHttpClient(this IServiceCollection services, string name)
125
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
135
public static
IHttpClientBuilder
AddHttpClient(this IServiceCollection services, string name, Action<HttpClient> configureClient)
155
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
165
public static
IHttpClientBuilder
AddHttpClient(this IServiceCollection services, string name, Action<IServiceProvider, HttpClient> configureClient)
188
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
200
public static
IHttpClientBuilder
AddHttpClient<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TClient>(
228
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
240
public static
IHttpClientBuilder
AddHttpClient<TClient, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(
265
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
280
public static
IHttpClientBuilder
AddHttpClient<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TClient>(
308
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
323
public static
IHttpClientBuilder
AddHttpClient<TClient, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(
349
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
361
public static
IHttpClientBuilder
AddHttpClient<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TClient>(
388
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
400
public static
IHttpClientBuilder
AddHttpClient<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TClient>(
431
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
443
public static
IHttpClientBuilder
AddHttpClient<TClient, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(
475
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
487
public static
IHttpClientBuilder
AddHttpClient<TClient, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(
515
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
530
public static
IHttpClientBuilder
AddHttpClient<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TClient>(
557
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
572
public static
IHttpClientBuilder
AddHttpClient<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TClient>(
603
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
618
public static
IHttpClientBuilder
AddHttpClient<TClient, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(
650
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
665
public static
IHttpClientBuilder
AddHttpClient<TClient, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(
695
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
707
public static
IHttpClientBuilder
AddHttpClient<TClient, TImplementation>(this IServiceCollection services, Func<HttpClient, TImplementation> factory)
732
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
746
public static
IHttpClientBuilder
AddHttpClient<TClient, TImplementation>(this IServiceCollection services, string name, Func<HttpClient, TImplementation> factory)
774
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
786
public static
IHttpClientBuilder
AddHttpClient<TClient, TImplementation>(this IServiceCollection services, Func<HttpClient, IServiceProvider, TImplementation> factory)
811
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
823
public static
IHttpClientBuilder
AddHttpClient<TClient, TImplementation>(this IServiceCollection services, string name, Func<HttpClient, IServiceProvider, TImplementation> factory)
HttpClientFactoryOptions.cs (1)
99
/// <see cref="HttpClientBuilderExtensions.AddHttpMessageHandler{THandler}(
IHttpClientBuilder
)"/>.
ITypedHttpClientFactory.cs (1)
20
/// <see cref="HttpClientBuilderExtensions.AddTypedClient{TClient}(
IHttpClientBuilder
)"/> functionality. This type
Microsoft.Extensions.Http.Polly (31)
DependencyInjection\PollyHttpClientBuilderExtensions.cs (29)
23
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
25
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
31
public static
IHttpClientBuilder
AddPolicyHandler(this
IHttpClientBuilder
builder, IAsyncPolicy<HttpResponseMessage> policy)
51
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
55
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
61
public static
IHttpClientBuilder
AddPolicyHandler(
62
this
IHttpClientBuilder
builder,
83
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
87
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
93
public static
IHttpClientBuilder
AddPolicyHandler(
94
this
IHttpClientBuilder
builder,
118
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
122
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
128
public static
IHttpClientBuilder
AddPolicyHandlerFromRegistry(this
IHttpClientBuilder
builder, string policyKey)
155
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
159
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
165
public static
IHttpClientBuilder
AddPolicyHandlerFromRegistry(
166
this
IHttpClientBuilder
builder,
192
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
194
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
212
/// <see cref="AddPolicyHandler(
IHttpClientBuilder
, IAsyncPolicy{HttpResponseMessage})"/> as desired.
215
public static
IHttpClientBuilder
AddTransientHttpErrorPolicy(
216
this
IHttpClientBuilder
builder,
242
/// <param name="builder">The <see cref="
IHttpClientBuilder
"/>.</param>
245
/// <returns>An <see cref="
IHttpClientBuilder
"/> that can be used to configure the client.</returns>
254
public static
IHttpClientBuilder
AddPolicyHandler(this
IHttpClientBuilder
builder, Func<IServiceProvider, HttpRequestMessage, string, IAsyncPolicy<HttpResponseMessage>> policyFactory, Func<HttpRequestMessage, string> keySelector)
PolicyHttpMessageHandler.cs (2)
30
/// The <see cref="PollyHttpClientBuilderExtensions.AddPolicyHandler(
IHttpClientBuilder
, IAsyncPolicy{HttpResponseMessage})"/>
49
/// The <see cref="PollyHttpClientBuilderExtensions.AddTransientHttpErrorPolicy(
IHttpClientBuilder
, Func{PolicyBuilder{HttpResponseMessage}, IAsyncPolicy{HttpResponseMessage}})"/>