Interface HttpClient
- All Known Implementing Classes:
AbstractHttpClient,ApacheHttpClient,AsyncHttpClient,NingAsyncHttpClient,OkHttpClient
public interface HttpClient
Http client that can be used to query embedded server.
After test suite, client should be properly destroyed
using destroy() method.
-
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Destroy client.Get the client configuration.booleanCheck that HTTP client has been destroyed.prepareDelete(String endpoint) CreateDELETErequest.prepareDelete(String endpoint, HttpRequestBody body) CreateDELETErequest.prepareGet(String endpoint) CreateGETrequest.prepareHead(String endpoint) CreateHEADrequest.preparePatch(String endpoint) CreatePATCHrequest.preparePatch(String endpoint, HttpRequestBody body) CreatePATCHrequest.preparePost(String endpoint) CreatePOSTrequest.preparePost(String endpoint, HttpRequestBody body) CreatePOSTrequest.preparePut(String url) CreatePUTrequest.preparePut(String url, HttpRequestBody body) CreatePUTrequest.prepareRequest(HttpMethod httpMethod, String endpoint) Create request.
-
Method Details
-
getConfiguration
HttpClientConfiguration getConfiguration()Get the client configuration.- Returns:
- HTTP Client configuration.
-
prepareGet
CreateGETrequest.- Parameters:
endpoint- URL, full url or path relative to server url.- Returns:
- GET request.
- See Also:
-
preparePost
CreatePOSTrequest.- Parameters:
endpoint- URL, full url or path relative to server url.- Returns:
- POST request.
- See Also:
-
preparePost
CreatePOSTrequest.- Parameters:
endpoint- URL, full url or path relative to server url.body- Request body.- Returns:
- POST request.
- See Also:
-
preparePut
CreatePUTrequest.- Parameters:
url- URL, full url or path relative to server url.- Returns:
- PUT request.
- See Also:
-
preparePut
CreatePUTrequest.- Parameters:
url- URL, full url or path relative to server url.body- Request body.- Returns:
- PUT request.
- See Also:
-
prepareDelete
CreateDELETErequest.- Parameters:
endpoint- URL, full url or path relative to server url.- Returns:
- DELETE request.
- See Also:
-
prepareDelete
CreateDELETErequest.- Parameters:
endpoint- URL, full url or path relative to server url.body- Request body.- Returns:
- DELETE request.
- See Also:
-
preparePatch
CreatePATCHrequest.- Parameters:
endpoint- URL, full url or path relative to server url.- Returns:
- PATCH request.
- See Also:
-
preparePatch
CreatePATCHrequest.- Parameters:
endpoint- URL, full url or path relative to server url.body- Request body.- Returns:
- PATCH request.
- See Also:
-
prepareHead
CreateHEADrequest.- Parameters:
endpoint- URL, full url or path relative to server url.- Returns:
- HEAD request.
- See Also:
-
prepareRequest
Create request.Once destroyed, this client should not be able to create HTTP request and should throw an instance of
IllegalStateException.- Parameters:
httpMethod- Http method (i.eGET,POST,PUT,DELETE).endpoint- URL, full url or path relative to server url.- Returns:
- The request.
- Throws:
IllegalStateException- If client has already been destroyed.- See Also:
-
destroy
void destroy()Destroy client. -
isDestroyed
boolean isDestroyed()Check that HTTP client has been destroyed.- Returns:
trueif client is closed,falseotherwise.
-