@@ -63,6 +63,10 @@ public interface HttpClient extends Measured {
6363 */
6464 Future <HttpClientRequest > request (RequestOptions options );
6565
66+ default <T > Future <T > request (RequestOptions options , Function <HttpClientRequest , Future <T >> handler ) {
67+ return request (options ).compose (handler );
68+ }
69+
6670 /**
6771 * Create an HTTP request to send to the server at the {@code host} and {@code port}.
6872 *
@@ -74,6 +78,10 @@ public interface HttpClient extends Measured {
7478 */
7579 Future <HttpClientRequest > request (HttpMethod method , int port , String host , String requestURI );
7680
81+ default <T > Future <T > request (HttpMethod method , int port , String host , String requestURI , Function <HttpClientRequest , Future <T >> handler ) {
82+ return request (method , port , host , requestURI ).compose (handler );
83+ }
84+
7785 /**
7886 * Create an HTTP request to send to the server at the {@code host} and default port.
7987 *
@@ -84,6 +92,10 @@ public interface HttpClient extends Measured {
8492 */
8593 Future <HttpClientRequest > request (HttpMethod method , String host , String requestURI );
8694
95+ default <T > Future <T > request (HttpMethod method , String host , String requestURI , Function <HttpClientRequest , Future <T >> handler ) {
96+ return request (method , host , requestURI ).compose (handler );
97+ }
98+
8799 /**
88100 * Create an HTTP request to send to the server at the default host and port.
89101 *
@@ -93,6 +105,10 @@ public interface HttpClient extends Measured {
93105 */
94106 Future <HttpClientRequest > request (HttpMethod method , String requestURI );
95107
108+ default <T > Future <T > request (HttpMethod method , String requestURI , Function <HttpClientRequest , Future <T >> handler ) {
109+ return request (method , requestURI ).compose (handler );
110+ }
111+
96112 /**
97113 * Connect a WebSocket to the specified port, host and relative request URI.
98114 *
0 commit comments