/** * Slightly shorter version of {@link #withNoArguments()}. * * @return A list of no arguments. * @see #withNoArguments() */ public static List<Argument> withNoArgs() { return withNoArguments(); }
/** * Use http digest authentication. Note that you need to encode the password yourself. * * @param userName The user name. * @param password The password. * @return The authentication scheme */ public static AuthenticationScheme digest(String userName, String password) { return basic(userName, password); }
/** * Slightly shorter version of {@link #withArguments(Object, Object...)}. * * @return A list of arguments. * @see #withArguments(Object, Object...) */ public static List<Argument> withArgs(Object firstArgument, Object... additionalArguments) { return withArguments(firstArgument, additionalArguments); }
/** * Perform a PATCH request to a <code>path</code>. Normally the path doesn't have to be fully-qualified e.g. you don't need to * specify the path as <tt>http://localhost:8080/path</tt>. In this case it's enough to use <tt>/path</tt>. * * @param path The path to send the request to. * @param pathParams The path parameters. E.g. if path is "/book/{hotelId}/{roomNumber}" you can do <code>head("/book/{hotelName}/{roomNumber}", "Hotels R Us", 22);</code>. * @return The response of the request. */ public static Response patch(String path, Object... pathParams) { return given().patch(path, pathParams); }
/** * Start building the request part of the test com.jayway.restassured.specification. E.g. * <p/> * <pre> * with().parameters("firstName", "John", "lastName", "Doe").when().post("/greetXML").then().assertThat().body("greeting.firstName", equalTo("John")); * </pre> * <p/> * will send a POST request to "/greetXML" with request parameters <tt>firstName=John</tt> and <tt>lastName=Doe</tt> and * expect that the response body containing JSON or XML firstName equal to John. * <p/> * The only difference between {@link #with()} and {@link #given()} is syntactical. * * @return A request specification. */ public static RequestSpecification with() { return given(); }
/** * Use relaxed HTTP validation with protocol {@value #SSL}. This means that you'll trust all hosts regardless if the SSL certificate is invalid. By using this * method you don't need to specify a keystore (see {@link #keystore(String, String)} or trust store (see {@link #trustStore(java.security.KeyStore)}. * <p> * This is just a shortcut for: * </p> * <pre> * RestAssured.config = RestAssured.config().sslConfig(sslConfig().relaxedHTTPSValidation()); * </pre> */ public static void useRelaxedHTTPSValidation() { useRelaxedHTTPSValidation(SSL); }
/** * Instruct REST Assured to connect to a proxy on the specified port on localhost with a specific scheme. * * @param host The hostname of the proxy to connect to (for example <code>127.0.0.1</code>) * @param port The port of the proxy to connect to (for example <code>8888</code>) * @param scheme The http scheme (http or https) */ public static void proxy(String host, int port, String scheme) { proxy(new ProxySpecification(host, port, scheme)); }
/** * Sets a certificate to be used for SSL authentication. See {@link Class#getResource(String)} for how to get a URL from a resource * on the classpath. * <p/> * * @param certURL URL to a JKS keystore where the certificate is stored. * @param password The password for the keystore * @param certificateAuthSettings More advanced settings for the certificate authentication */ public static AuthenticationScheme certificate(String certURL, String password, CertificateAuthSettings certificateAuthSettings) { return certificate(certURL, password, "", "", certificateAuthSettings); }
/** * Enable logging of both the request and the response if REST Assureds test validation fails with log detail equal to {@link com.jayway.restassured.filter.log.LogDetail#ALL}. * <p/> * <p> * This is just a shortcut for: * </p> * <pre> * RestAssured.config = RestAssured.config().logConfig(logConfig().enableLoggingOfRequestAndResponseIfValidationFails()); * </pre> */ public static void enableLoggingOfRequestAndResponseIfValidationFails() { enableLoggingOfRequestAndResponseIfValidationFails(LogDetail.ALL); }
/** * Uses the user default keystore stored in @{user.home}/.keystore * * <p> * Note that this is just a shortcut for: * </p> * <pre> * RestAssured.config = RestAssured.config().sslConfig(sslConfig().keystore(password)); * </pre> * * @param password - Use null for no password */ public static void keystore(String password) { applyKeyStore(null, password); }
/** * Use form authentication. Rest Assured will try to parse the response * login page and determine and try find the action, username and password input * field automatically. * <p> * Note that the request will be much faster if you also supply a form auth configuration. * </p> * * @param userName The user name. * @param password The password. * @return The authentication scheme * @see #form(String, String, com.jayway.restassured.authentication.FormAuthConfig) */ public static AuthenticationScheme form(String userName, String password) { return form(userName, password, null); }
/** * Perform a GET request to a <code>path</code>. Normally the path doesn't have to be fully-qualified e.g. you don't need to * specify the path as <tt>http://localhost:8080/path</tt>. In this case it's enough to use <tt>/path</tt>. * * @param path The path to send the request to. * @param pathParams The path parameters. * @return The response of the GET request. */ public static Response get(String path, Map<String, ?> pathParams) { return given().get(path, pathParams); }
/** * Perform a OPTIONS request to a <code>path</code>. Normally the path doesn't have to be fully-qualified e.g. you don't need to * specify the path as <tt>http://localhost:8080/path</tt>. In this case it's enough to use <tt>/path</tt>. * * @param path The path to send the request to. * @param pathParams The path parameters. * @return The response of the request. */ public static Response options(String path, Map<String, ?> pathParams) { return given().options(path, pathParams); }