HttpClient Examples (Async)
-
This example demonstrates a basic asynchronous HTTP request / response exchange. Response content is buffered in memory for simplicity.
-
Asynchronous HTTP exchange with content streaming
This example demonstrates an asynchronous HTTP request / response exchange with a full content streaming.
-
This example demonstrates a pipelined execution of multiple HTTP/1.1 request / response exchanges. Response content is buffered in memory for simplicity.
-
This example demonstrates a multiplexed execution of multiple HTTP/2 request / response exchanges. Response content is buffered in memory for simplicity.
-
Request execution interceptors
This example demonstrates how to insert custom request interceptor and an execution interceptor to the request execution chain.
-
This example demonstrates how to use a custom execution interceptor to add trailers to all outgoing request enclosing an entity..
This example demonstrates handling of HTTP/2 message exchanges pushed by the server.
-
This example demonstrates execution of an HTTP request against a target site that requires user authentication.
-
This example demonstrates how to create secure connections with a custom SSL context.
-
Connection / TLS configuation per route / host
This example demonstrates how to use connection configuration on a per-route or a per-host basis.
-
This example demonstrates how to evict expired and idle connections from the connection pool.
-
Preemptive BASIC authentication
This example shows how HttpClient can be customized to authenticate preemptively using BASIC scheme. Generally, preemptive authentication can be considered less secure than a response to an authentication challenge and therefore discouraged.
-
This example demonstrates how to make HttpClient negotiate or force a particular version of HTTP protocol during the TLS handshake. Please note that protocol version policy setting also applies to non-HTTPS connections.
-
This example demonstrates how to use SNI to send requests to a virtual HTTPS endpoint using the async I/O.