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(java.lang.String path)
Make a DELETE request to the specified path.
|
java.lang.String |
deleteText()
A convenience method for doing a DELETE request then calling
ReceivedResponse.getBody() then TypedData.getText(). |
java.lang.String |
deleteText(java.lang.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(java.lang.String path)
Make a GET request to the specified path.
|
ApplicationUnderTest |
getApplicationUnderTest() |
java.util.List<io.netty.handler.codec.http.cookie.Cookie> |
getCookies(java.lang.String path)
Get cookies with
Path= attribute equal to path and all its subpaths. |
ReceivedResponse |
getResponse() |
java.lang.String |
getText()
A convenience method for doing a GET request then calling
ReceivedResponse.getBody() then TypedData.getText(). |
java.lang.String |
getText(java.lang.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(java.lang.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(java.lang.String path)
Make a OPTIONS request to the specified path.
|
java.lang.String |
optionsText()
A convenience method for doing a OPTIONS request then calling
ReceivedResponse.getBody() then TypedData.getText(). |
java.lang.String |
optionsText(java.lang.String path)
A convenience method for doing a OPTIONS request then calling
ReceivedResponse.getBody() then TypedData.getText(). |
TestHttpClient |
params(Action<? super com.google.common.collect.ImmutableMultimap.Builder<java.lang.String,java.lang.Object>> params) |
ReceivedResponse |
patch()
Make a PATCH request with a path of "" this is the same as calling patch("").
|
ReceivedResponse |
patch(java.lang.String path)
Make a PATCH request to the specified path.
|
java.lang.String |
patchText()
A convenience method for doing a PATCH request then calling
ReceivedResponse.getBody() then TypedData.getText(). |
java.lang.String |
patchText(java.lang.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(java.lang.String path)
Make a POST request to the specified path.
|
java.lang.String |
postText()
A convenience method for doing a POST request then calling
ReceivedResponse.getBody() then TypedData.getText(). |
java.lang.String |
postText(java.lang.String path)
A convenience method for doing a POST 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(java.lang.String path)
Make a PUT request to the specified path.
|
java.lang.String |
putText()
A convenience method for doing a PUT request then calling
ReceivedResponse.getBody() then TypedData.getText(). |
java.lang.String |
putText(java.lang.String path)
A convenience method for doing a PUT request then calling
ReceivedResponse.getBody() then TypedData.getText(). |
ReceivedResponse |
request(Action<? super RequestSpec> requestAction)
Executes the request as specified by the provided
RequestSpec. |
ReceivedResponse |
request(java.lang.String path,
Action<? super RequestSpec> requestAction)
Executes the request as specified by the provided
RequestSpec against the provided path. |
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(ApplicationUnderTest applicationUnderTest)
applicationUnderTest - the Ratpack application to make requests againststatic TestHttpClient testHttpClient(ApplicationUnderTest applicationUnderTest, @Nullable Action<? super RequestSpec> requestConfigurer)
The settings provided can be overridden on a per request basis via requestSpec(ratpack.func.Action<? super ratpack.http.client.RequestSpec>).
applicationUnderTest - the Ratpack application to make requests againstrequestConfigurer - a Action that will set up the RequestSpec for all requests made through this instance of TestHttpClientApplicationUnderTest getApplicationUnderTest()
TestHttpClient requestSpec(Action<? super RequestSpec> requestAction)
requestAction - an Action that will act on the RequestSpec this is used to configure details of the next requestTestHttpClient params(Action<? super com.google.common.collect.ImmutableMultimap.Builder<java.lang.String,java.lang.Object>> params)
params - the params that will be used with the HttpUrlBuilder passed into HttpUrlBuilder.params(Action)void resetRequest()
ReceivedResponse getResponse()
ReceivedResponse head()
ReceivedResponse head(java.lang.String path)
path - the path the request is made againstReceivedResponse options()
ReceivedResponse options(java.lang.String path)
path - the path the request is made againstjava.lang.String optionsText()
ReceivedResponse.getBody() then TypedData.getText().java.lang.String optionsText(java.lang.String path)
ReceivedResponse.getBody() then TypedData.getText().path - the path the request is made againstReceivedResponse get()
ReceivedResponse get(java.lang.String path)
path - the path the request is made againstjava.lang.String getText()
ReceivedResponse.getBody() then TypedData.getText().
Useful if you need to only check details of the response body.java.lang.String getText(java.lang.String path)
ReceivedResponse.getBody() then TypedData.getText().
Useful if you need to only check details of the response body.path - the path the request is made againstReceivedResponse post()
ReceivedResponse post(java.lang.String path)
path - the path the request is made againstjava.lang.String postText()
ReceivedResponse.getBody() then TypedData.getText().java.lang.String postText(java.lang.String path)
ReceivedResponse.getBody() then TypedData.getText().path - the path the request is made againstReceivedResponse put()
ReceivedResponse put(java.lang.String path)
path - the path the request is made againstjava.lang.String putText()
ReceivedResponse.getBody() then TypedData.getText().java.lang.String putText(java.lang.String path)
ReceivedResponse.getBody() then TypedData.getText().path - the path the request is made againstReceivedResponse patch()
ReceivedResponse patch(java.lang.String path)
path - the path the request is made againstjava.lang.String patchText()
ReceivedResponse.getBody() then TypedData.getText().java.lang.String patchText(java.lang.String path)
ReceivedResponse.getBody() then TypedData.getText().path - the path the request is made againstReceivedResponse delete()
ReceivedResponse delete(java.lang.String path)
path - the path the request is made againstjava.lang.String deleteText()
ReceivedResponse.getBody() then TypedData.getText().java.lang.String deleteText(java.lang.String path)
ReceivedResponse.getBody() then TypedData.getText().path - the path the request is made againstjava.util.List<io.netty.handler.codec.http.cookie.Cookie> getCookies(java.lang.String path)
Path= attribute equal to path and all its subpaths.path - a URI path attached to cookiespathReceivedResponse request(Action<? super RequestSpec> requestAction)
RequestSpec.
If the request method is not specified by the provided action, it will default to being a GET request.
The action provided to this method is additive to that configured with the requestSpec(ratpack.func.Action<? super ratpack.http.client.RequestSpec>) method.
requestAction - an action to configure this requestReceivedResponse request(java.lang.String path, Action<? super RequestSpec> requestAction)
RequestSpec against the provided path.
If the request method is not specified by the provided action, it will default to being a GET request.
The action provided to this method is additive to that configured with the requestSpec(ratpack.func.Action<? super ratpack.http.client.RequestSpec>) method.
path - the path the request will be made againstrequestAction - an action to configure this requestrequest(ratpack.func.Action<? super ratpack.http.client.RequestSpec>)