Java DSL for easy testing of REST services
—
Core HTTP request methods providing direct access to common REST operations with support for path parameters, query parameters, and URI-based requests.
Performs HTTP GET requests for retrieving data from REST endpoints.
/**
* Perform a GET request to a path with optional path parameters
* @param path The path to send the request to
* @param pathParams Path parameters for template substitution
* @return The HTTP response
*/
static Response get(String path, Object... pathParams);
/**
* Perform a GET request to a path with path parameters as a Map
* @param path The path to send the request to
* @param pathParams Path parameters map
* @return The HTTP response
*/
static Response get(String path, Map<String, ?> pathParams);
/**
* Perform a GET request to a URI
* @param uri The complete URI to send the request to
* @return The HTTP response
*/
static Response get(URI uri);
/**
* Perform a GET request to a URL
* @param url The complete URL to send the request to
* @return The HTTP response
*/
static Response get(URL url);
/**
* Perform a GET request to the configured base URI/port
* @return The HTTP response
*/
static Response get();Usage Examples:
// Basic GET request
Response response = get("/users/123");
// GET with path parameters
Response response = get("/users/{id}/posts/{postId}", 123, 456);
// GET with path parameters map
Map<String, Object> params = new HashMap<>();
params.put("userId", 123);
params.put("postId", 456);
Response response = get("/users/{userId}/posts/{postId}", params);
// GET with complete URI
Response response = get(URI.create("https://api.example.com/users"));Performs HTTP POST requests for creating new resources.
/**
* Perform a POST request to a path with optional path parameters
* @param path The path to send the request to
* @param pathParams Path parameters for template substitution
* @return The HTTP response
*/
static Response post(String path, Object... pathParams);
/**
* Perform a POST request to a path with path parameters as a Map
* @param path The path to send the request to
* @param pathParams Path parameters map
* @return The HTTP response
*/
static Response post(String path, Map<String, ?> pathParams);
/**
* Perform a POST request to a URI
* @param uri The complete URI to send the request to
* @return The HTTP response
*/
static Response post(URI uri);
/**
* Perform a POST request to a URL
* @param url The complete URL to send the request to
* @return The HTTP response
*/
static Response post(URL url);
/**
* Perform a POST request to the configured base URI/port
* @return The HTTP response
*/
static Response post();Performs HTTP PUT requests for updating existing resources.
/**
* Perform a PUT request to a path with optional path parameters
* @param path The path to send the request to
* @param pathParams Path parameters for template substitution
* @return The HTTP response
*/
static Response put(String path, Object... pathParams);
/**
* Perform a PUT request to a path with path parameters as a Map
* @param path The path to send the request to
* @param pathParams Path parameters map
* @return The HTTP response
*/
static Response put(String path, Map<String, ?> pathParams);
/**
* Perform a PUT request to a URI
* @param uri The complete URI to send the request to
* @return The HTTP response
*/
static Response put(URI uri);
/**
* Perform a PUT request to a URL
* @param url The complete URL to send the request to
* @return The HTTP response
*/
static Response put(URL url);
/**
* Perform a PUT request to the configured base URI/port
* @return The HTTP response
*/
static Response put();Performs HTTP DELETE requests for removing resources.
/**
* Perform a DELETE request to a path with optional path parameters
* @param path The path to send the request to
* @param pathParams Path parameters for template substitution
* @return The HTTP response
*/
static Response delete(String path, Object... pathParams);
/**
* Perform a DELETE request to a path with path parameters as a Map
* @param path The path to send the request to
* @param pathParams Path parameters map
* @return The HTTP response
*/
static Response delete(String path, Map<String, ?> pathParams);
/**
* Perform a DELETE request to a URI
* @param uri The complete URI to send the request to
* @return The HTTP response
*/
static Response delete(URI uri);
/**
* Perform a DELETE request to a URL
* @param url The complete URL to send the request to
* @return The HTTP response
*/
static Response delete(URL url);
/**
* Perform a DELETE request to the configured base URI/port
* @return The HTTP response
*/
static Response delete();Performs HTTP HEAD requests for retrieving headers without response body.
/**
* Perform a HEAD request to a path with optional path parameters
* @param path The path to send the request to
* @param pathParams Path parameters for template substitution
* @return The HTTP response
*/
static Response head(String path, Object... pathParams);
/**
* Perform a HEAD request to a path with path parameters as a Map
* @param path The path to send the request to
* @param pathParams Path parameters map
* @return The HTTP response
*/
static Response head(String path, Map<String, ?> pathParams);
/**
* Perform a HEAD request to a URI
* @param uri The complete URI to send the request to
* @return The HTTP response
*/
static Response head(URI uri);
/**
* Perform a HEAD request to a URL
* @param url The complete URL to send the request to
* @return The HTTP response
*/
static Response head(URL url);
/**
* Perform a HEAD request to the configured base URI/port
* @return The HTTP response
*/
static Response head();Performs HTTP PATCH requests for partial resource updates.
/**
* Perform a PATCH request to a path with optional path parameters
* @param path The path to send the request to
* @param pathParams Path parameters for template substitution
* @return The HTTP response
*/
static Response patch(String path, Object... pathParams);
/**
* Perform a PATCH request to a path with path parameters as a Map
* @param path The path to send the request to
* @param pathParams Path parameters map
* @return The HTTP response
*/
static Response patch(String path, Map<String, ?> pathParams);
/**
* Perform a PATCH request to a URI
* @param uri The complete URI to send the request to
* @return The HTTP response
*/
static Response patch(URI uri);
/**
* Perform a PATCH request to a URL
* @param url The complete URL to send the request to
* @return The HTTP response
*/
static Response patch(URL url);
/**
* Perform a PATCH request to the configured base URI/port
* @return The HTTP response
*/
static Response patch();Performs HTTP OPTIONS requests for discovering allowed methods and CORS information.
/**
* Perform an OPTIONS request to a path with optional path parameters
* @param path The path to send the request to
* @param pathParams Path parameters for template substitution
* @return The HTTP response
*/
static Response options(String path, Object... pathParams);
/**
* Perform an OPTIONS request to a path with path parameters as a Map
* @param path The path to send the request to
* @param pathParams Path parameters map
* @return The HTTP response
*/
static Response options(String path, Map<String, ?> pathParams);
/**
* Perform an OPTIONS request to a URI
* @param uri The complete URI to send the request to
* @return The HTTP response
*/
static Response options(URI uri);
/**
* Perform an OPTIONS request to a URL
* @param url The complete URL to send the request to
* @return The HTTP response
*/
static Response options(URL url);
/**
* Perform an OPTIONS request to the configured base URI/port
* @return The HTTP response
*/
static Response options();Performs HTTP requests with custom or non-standard HTTP methods.
/**
* Perform a request with a specific HTTP method
* @param method The HTTP method to use
* @param path The path to send the request to
* @param pathParams Path parameters for template substitution
* @return The HTTP response
*/
static Response request(Method method, String path, Object... pathParams);
/**
* Perform a request with a custom HTTP method string
* @param method The HTTP method name as string
* @param path The path to send the request to
* @param pathParams Path parameters for template substitution
* @return The HTTP response
*/
static Response request(String method, String path, Object... pathParams);
/**
* Perform a request with a specific HTTP method to a URI
* @param method The HTTP method to use
* @param uri The complete URI to send the request to
* @return The HTTP response
*/
static Response request(Method method, URI uri);
/**
* Perform a request with a specific HTTP method to a URL
* @param method The HTTP method to use
* @param url The complete URL to send the request to
* @return The HTTP response
*/
static Response request(Method method, URL url);
/**
* Perform a request with a custom HTTP method string to a URI
* @param method The HTTP method name as string
* @param uri The complete URI to send the request to
* @return The HTTP response
*/
static Response request(String method, URI uri);
/**
* Perform a request with a custom HTTP method string to a URL
* @param method The HTTP method name as string
* @param url The complete URL to send the request to
* @return The HTTP response
*/
static Response request(String method, URL url);
/**
* Perform a request with a specific HTTP method to configured base URI/port
* @param method The HTTP method to use
* @return The HTTP response
*/
static Response request(Method method);
/**
* Perform a request with a custom HTTP method string to configured base URI/port
* @param method The HTTP method name as string
* @return The HTTP response
*/
static Response request(String method);Usage Examples:
// Custom HTTP method using Method enum
Response response = request(Method.TRACE, "/debug");
// Custom HTTP method using string
Response response = request("CUSTOM", "/api/custom-endpoint");
// WebDAV methods
Response response = request("PROPFIND", "/webdav/folder");
Response response = request("MKCOL", "/webdav/new-collection");// HTTP method enumeration
enum Method {
GET, POST, PUT, DELETE, HEAD, PATCH, OPTIONS, TRACE
}Install with Tessl CLI
npx tessl i tessl/maven-io-rest-assured--rest-assured