public interface HttpClient
Modifier and Type | Method and Description |
---|---|
default Promise<ReceivedResponse> |
get(URI uri) |
Promise<ReceivedResponse> |
get(URI uri,
Action<? super RequestSpec> action)
An asynchronous method to do a GET HTTP request, the URL and all details of the request are configured by the Action acting on the RequestSpec, but the method will be defaulted to a GET.
|
Promise<ReceivedResponse> |
post(URI uri,
Action<? super RequestSpec> action)
An asynchronous method to do a POST HTTP request, the URL and all details of the request are configured by the Action acting on the RequestSpec, but the method will be defaulted to a POST.
|
Promise<ReceivedResponse> |
request(URI uri,
Action<? super RequestSpec> action)
An asynchronous method to do a HTTP request, the URL and all details of the request are configured by the Action acting on the RequestSpec.
|
Promise<StreamedResponse> |
requestStream(URI uri,
Action<? super RequestSpec> requestConfigurer)
An asynchronous method to do a HTTP request, the URL and all details of the request are configured by the Action acting on the RequestSpec,
the received response content will be streamed.
|
Promise<ReceivedResponse> get(URI uri, Action<? super RequestSpec> action)
uri
- the request URL (as a URI), must be of the http
or https
protocolaction
- An action that will act on the RequestSpec
ReceivedResponse
default Promise<ReceivedResponse> get(URI uri)
Promise<ReceivedResponse> post(URI uri, Action<? super RequestSpec> action)
uri
- the request URL (as a URI), must be of the http
or https
protocolaction
- An action that will act on the RequestSpec
ReceivedResponse
Promise<ReceivedResponse> request(URI uri, Action<? super RequestSpec> action)
uri
- the request URL (as a URI), must be of the http
or https
protocolaction
- An action that will act on the RequestSpec
ReceivedResponse
Promise<StreamedResponse> requestStream(URI uri, Action<? super RequestSpec> requestConfigurer)
In order to access the response content stream either subscribe to the Publisher
returned from StreamedResponse.getBody()
or use StreamedResponse.send(ratpack.http.Response, ratpack.func.Action)
to directly stream the content as a server response.
uri
- the request URL (as a URI), must be of the http
or https
protocolrequestConfigurer
- an action that will act on the RequestSpec
StreamedResponse
StreamedResponse