ClientHandler Class¶
This adapts HttpRequestMessages to ASP.NET Core requests, dispatches them through the pipeline, and returns the associated HttpResponseMessage.
- Namespace
Microsoft.AspNetCore.TestHost
- Assemblies
- Microsoft.AspNetCore.TestHost
Inheritance Hierarchy¶
System.Object
System.Net.Http.HttpMessageHandler
Microsoft.AspNetCore.TestHost.ClientHandler
Syntax¶
public class ClientHandler : HttpMessageHandler, IDisposable
-
class
Microsoft.AspNetCore.TestHost.
ClientHandler
Constructors¶
-
ClientHandler
(Microsoft.AspNetCore.Http.PathString, Microsoft.AspNetCore.Hosting.Server.IHttpApplication<Microsoft.AspNetCore.Hosting.Internal.HostingApplication.Context>)¶ Create a new handler.
Arguments: - pathBase (Microsoft.AspNetCore.Http.PathString) – The base path.
- application (Microsoft.AspNetCore.Hosting.Server.IHttpApplication<Microsoft.AspNetCore.Hosting.Internal.HostingApplication.Context>) – The
Microsoft.AspNetCore.Hosting.Server.IHttpApplication`1
.
public ClientHandler(PathString pathBase, IHttpApplication<HostingApplication.Context> application)
-
Methods¶
-
SendAsync
(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken)¶ This adapts HttpRequestMessages to ASP.NET Core requests, dispatches them through the pipeline, and returns the associated HttpResponseMessage.
Return type: System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
-