Class HttpClientFactory
The default implementation of the HTTP client factory.
Inheritance
System.Object
HttpClientFactory
Implements
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Google.Apis.Http
Assembly: Google.Apis.Core.dll
Syntax
public class HttpClientFactory : IHttpClientFactory
Methods
CreateClientHandler()
Create a System.Net.Http.HttpClientHandler for use when communicating with the server. Please read the remarks closely before overriding this method.
Declaration
protected virtual HttpClientHandler CreateClientHandler()
Returns
Type | Description |
---|---|
System.Net.Http.HttpClientHandler | A suitable System.Net.Http.HttpClientHandler. |
Remarks
When overriding this method, please observe the following:
- System.Net.Http.HttpClientHandler.AllowAutoRedirect and System.Net.Http.HttpClientHandler.AutomaticDecompression of the returned instance are configured after this method returns. Configuring these within this method will have no effect.
- Return a new instance of an System.Net.Http.HttpClientHandler for each call to this method.
- This method may be called once, or more than once, when initializing a single client service.
CreateHandler(CreateHttpClientArgs)
Creates a HTTP message handler. Override this method to mock a message handler.
Declaration
protected virtual HttpMessageHandler CreateHandler(CreateHttpClientArgs args)
Parameters
Type | Name | Description |
---|---|---|
CreateHttpClientArgs | args |
Returns
Type | Description |
---|---|
System.Net.Http.HttpMessageHandler |
CreateHttpClient(CreateHttpClientArgs)
Creates a new configurable HTTP client.
Declaration
public ConfigurableHttpClient CreateHttpClient(CreateHttpClientArgs args)
Parameters
Type | Name | Description |
---|---|---|
CreateHttpClientArgs | args |
Returns
Type | Description |
---|---|
ConfigurableHttpClient |