Windows.Web.Http.HttpClient.HttpClient
June 5, 2019 ยท View on GitHub
-description
Initializes a new instance of the HttpClient class with a specific filter for handling HTTP response messages. For programming guidance for the HttpClient class, and code examples, see the HttpClient conceptual topic.
-parameters
-param filter
The HTTP filter to use for handling response messages.
-remarks
If a null reference (Nothing in Visual Basic) is specified for the filter parameter, the default transport handler for receiving responses with no filter is used.
-examples
The sample code shows creating an HttpClient to use a custom filter.
internal static void CreateHttpClient(ref HttpClient httpClient)
{
if (httpClient != null) {
httpClient.Dispose();
}
// HttpClient can be extended by plugging multiple filters together,
// providing HttpClient with the configured filter pipeline.
var baseFilter = new HttpBaseProtocolFilter();
var myFilter = new MyCustomFilter(baseFilter);
httpClient = new HttpClient(myFilter);
}
-see-also
HttpClient constructor, IHttpFilter, Windows.Web.Http.Filters, HttpClient