public interface RequestSpec
Modifier and Type | Interface and Description |
---|---|
static interface |
RequestSpec.Body
The request body.
|
Modifier and Type | Method and Description |
---|---|
RequestSpec |
body(Action<? super RequestSpec.Body> action)
Executes the given action with the
request body . |
RequestSpec.Body |
getBody()
The body of the request, used for specifying the body content.
|
MutableHeaders |
getHeaders() |
URI |
getUrl() |
RequestSpec |
headers(Action<? super MutableHeaders> action)
This method can be used to compose changes to the headers.
|
RequestSpec |
method(String method)
Set the HTTP verb to use.
|
RequestSpec |
readTimeout(int amount,
TimeUnit timeUnit) |
default RequestSpec |
readTimeoutSeconds(int seconds) |
RequestSpec |
redirects(int maxRedirects) |
RequestSpec redirects(int maxRedirects)
maxRedirects
- Sets the maximum number of redirects to followMutableHeaders getHeaders()
MutableHeaders
that can be used to configure the headers that will be used for the request.RequestSpec headers(Action<? super MutableHeaders> action) throws Exception
action
- Provide an action that will act on MutableHeaders.Exception
- This can be thrown from the action supplied.RequestSpec method(String method)
method
- which HTTP verb to useURI getUrl()
default RequestSpec readTimeoutSeconds(int seconds)
RequestSpec readTimeout(int amount, TimeUnit timeUnit)
RequestSpec.Body getBody()
RequestSpec body(Action<? super RequestSpec.Body> action) throws Exception
request body
.
This method is a “fluent API” alternative to getBody()
.
action
- configuration of the request bodyException
- any thrown by action