public interface TestHttpClient
Modifier and Type | Method and Description |
---|---|
ReceivedResponse |
delete()
Make a DELETE request with a path of "" this is the same as calling delete("")
|
ReceivedResponse |
delete(String path)
Make a DELETE request to the specified path.
|
String |
deleteText()
A convenience method for doing a DELETE request then calling
ReceivedResponse.getBody() then TypedData.getText() . |
String |
deleteText(String path)
A convenience method for doing a DELETE request then calling
ReceivedResponse.getBody() then TypedData.getText() . |
ReceivedResponse |
get()
Make a GET request with a path of "" this is the same as calling get("")
|
ReceivedResponse |
get(String path)
Make a GET request to the specified path.
|
ApplicationUnderTest |
getApplicationUnderTest() |
List<Cookie> |
getCookies(String path)
Get cookies with
Path= attribute equal to path and all its subpaths. |
ReceivedResponse |
getResponse() |
String |
getText()
A convenience method for doing a GET request then calling
ReceivedResponse.getBody() then TypedData.getText() . |
String |
getText(String path)
A convenience method for doing a GET request then calling
ReceivedResponse.getBody() then TypedData.getText() . |
ReceivedResponse |
head()
Make a HEAD request with a path of "" this is the same as calling head("")
|
ReceivedResponse |
head(String path)
Make a HEAD request to the specified path.
|
ReceivedResponse |
options()
Make a OPTIONS request with a path of "" this is the same as calling options("")
|
ReceivedResponse |
options(String path)
Make a OPTIONS request to the specified path.
|
TestHttpClient |
params(Action<? super ImmutableMultimap.Builder<String,Object>> params) |
ReceivedResponse |
patch()
Make a PATCH request with a path of "" this is the same as calling patch("")
|
ReceivedResponse |
patch(String path)
Make a PATCH request to the specified path.
|
String |
patchText()
A convenience method for doing a PATCH request then calling
ReceivedResponse.getBody() then TypedData.getText() . |
String |
patchText(String path)
A convenience method for doing a PATCH request then calling
ReceivedResponse.getBody() then TypedData.getText() . |
ReceivedResponse |
post()
Make a POST request with a path of "" this is the same as calling post("")
|
ReceivedResponse |
post(String path)
Make a POST request to the specified path.
|
String |
postText()
A convenience method for doing a POST request then calling
ReceivedResponse.getBody() then TypedData.getText() . |
String |
postText(String path)
A convenience method for doing a GET request then calling
ReceivedResponse.getBody() then TypedData.getText() . |
ReceivedResponse |
put()
Make a PUT request with a path of "" this is the same as calling put("")
|
ReceivedResponse |
put(String path)
Make a PUT request to the specified path.
|
String |
putText()
A convenience method for doing a PUT request then calling
ReceivedResponse.getBody() then TypedData.getText() . |
String |
putText(String path)
A convenience method for doing a PUT request then calling
ReceivedResponse.getBody() then TypedData.getText() . |
TestHttpClient |
requestSpec(Action<? super RequestSpec> requestAction) |
void |
resetRequest()
Set the requestSpec back to a No Op default and clear the cookies.
|
static TestHttpClient |
testHttpClient(ApplicationUnderTest applicationUnderTest)
A method to create an instance of the default implementation of TestHttpClient.
|
static TestHttpClient |
testHttpClient(ApplicationUnderTest applicationUnderTest,
Action<? super RequestSpec> requestConfigurer)
A method to create an instance of the default implementation of TestHttpClient.
|
static TestHttpClient |
testHttpClient(Factory<? extends RatpackServer> server) |
static TestHttpClient |
testHttpClient(RatpackServer server) |
static TestHttpClient testHttpClient(ApplicationUnderTest applicationUnderTest)
applicationUnderTest
- Which Ratpack application to make requests against.TestHttpClient
which is configured to make requests against the provided ApplicationUnderTeststatic TestHttpClient testHttpClient(ApplicationUnderTest applicationUnderTest, @Nullable Action<? super RequestSpec> requestConfigurer)
applicationUnderTest
- Which Ratpack application to make requests against.requestConfigurer
- A Action
that will set up the RequestSpec
for all requests made through this instance of TestHttpClient. These settings can be overridden on a per request basis via requestSpec(ratpack.func.Action<? super ratpack.http.client.RequestSpec>)
.TestHttpClient
which is configured to make requests against the provided ApplicationUnderTeststatic TestHttpClient testHttpClient(RatpackServer server)
static TestHttpClient testHttpClient(Factory<? extends RatpackServer> server)
ApplicationUnderTest getApplicationUnderTest()
ApplicationUnderTest
requests are being made against.TestHttpClient requestSpec(Action<? super RequestSpec> requestAction)
requestAction
- A Action
that will act on the RequestSpec
this is used to configure details of the next request.TestHttpClient params(Action<? super ImmutableMultimap.Builder<String,Object>> params)
params
- The params that will be used with the HttpUrlBuilder passed into HttpUrlBuilder.params(Action)
void resetRequest()
ReceivedResponse getResponse()
ReceivedResponse
from the last request sent.ReceivedResponse head()
ReceivedResponse
from the HEAD request.ReceivedResponse head(String path)
path
- What path the HEAD request will be made against.ReceivedResponse
from the HEAD request.ReceivedResponse options()
ReceivedResponse
from the OPTIONS request.ReceivedResponse options(String path)
path
- What path the OPTIONS request will be made against.ReceivedResponse
from the OPTIONS request.ReceivedResponse get()
ReceivedResponse
from the GET request.ReceivedResponse get(String path)
path
- What path the GET request will be made against.ReceivedResponse
from the GET request.String getText()
ReceivedResponse.getBody()
then TypedData.getText()
.
Useful if you need to only check details of the response body.String getText(String path)
ReceivedResponse.getBody()
then TypedData.getText()
.
Useful if you need to only check details of the response body.path
- What path the GET request will be made against.ReceivedResponse post()
ReceivedResponse
from the POST request.ReceivedResponse post(String path)
path
- What path the POST request will be made against.ReceivedResponse
from the POST request.String postText()
ReceivedResponse.getBody()
then TypedData.getText()
.String postText(String path)
ReceivedResponse.getBody()
then TypedData.getText()
.path
- What path the POST request will be made against.ReceivedResponse put()
ReceivedResponse
from the PUT request.ReceivedResponse put(String path)
path
- What path the PUT request will be made against.ReceivedResponse
from the PUT request.String putText()
ReceivedResponse.getBody()
then TypedData.getText()
.String putText(String path)
ReceivedResponse.getBody()
then TypedData.getText()
.path
- What path the PUT request will be made against.ReceivedResponse patch()
ReceivedResponse
from the PATCH request.ReceivedResponse patch(String path)
path
- Make a PATCH request to the specified path.ReceivedResponse
from the PATCH request.String patchText()
ReceivedResponse.getBody()
then TypedData.getText()
.String patchText(String path)
ReceivedResponse.getBody()
then TypedData.getText()
.path
- What path the PATCH request will be made against.ReceivedResponse delete()
ReceivedResponse
from the DELETE request.ReceivedResponse delete(String path)
path
- What path the DELETE request will be made against.ReceivedResponse
from the DELETE request.String deleteText()
ReceivedResponse.getBody()
then TypedData.getText()
.String deleteText(String path)
ReceivedResponse.getBody()
then TypedData.getText()
.path
- What path the DELETE request will be made against.