-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
ReleaseNotes31
-
Now using
java.lang.reflect.Type
instead ofjava.lang.Class
in the API for mapping to Java objects. For users of the REST Assured API the change is mostly prominent in the ResponseBodyExtractionOptions interface where theas
method now takes ajava.lang.reflect.Type
instead ofjava.lang.Class
. This should not cause any backward incompatibilities unless you've written a custom ObjectMapperFactory. See non-backward compatible changes if this is the case. -
Allow querying (extracting values out of) a request specification without using a filter by using the
io.restassured.specification.SpecificationQuerier
. For example:RequestSpecification spec = ... QueryableRequestSpecification queryable = SpecificationQuerier.query(spec); String headerValue = queryable.getHeaders().getValue("header"); String param = queryable.getFormParams().get("someparam");
-
It's now possible to parse and include additional input fields when using form authentication. Just use the
FormAuthConfig
and specify the additional values to include. For example if you have an html page that looks like this:<html> <head> <title>Login</title> </head> <body> <form action="/login" method="POST"> <table> <tr> <td>User: </td> <td><input type="text" name="j_username"></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="j_password"></td> </tr> <tr> <td colspan="2"><input name="submit" type="submit"/></td> </tr> </table> <input type="hidden" name="firstInputField" value="value1"/> <input type="hidden" name="secondInputField" value="value2"/> </form> </body> </html>
and you'd like to include the value of form parameters
firstInputField
andsecondInputField
you can do like this:given().auth().form("username", "password", formAuthConfig().withAdditionalFields("firstInputField", "secondInputField"). ..
REST Assured will automatically parse the HTML page, find the values for the additional fields and include them as form parameters in the login request.
-
Add better integration for standard HTTP methods with Apache HttpClient which also solves an issue content-type header being generated for empty GET requests
-
No longer using
DEF_CONTENT_CHARSET
from Apache HttpClient since it caused compatibility issues -
Removing Authorization header when setting
auth().none()
-
Fixed so that it's possible to specify arguments to root paths in multi expectation blocks such as:
get("/jsonStore").then() .root("store.book.find { it.author == '%s' }.price") .body( withArgs("Nigel Rees"), is(8.95f), withArgs("Evelyn Waugh"), is(12.99f), withArgs("Herman Melville"), is(8.99f), withArgs("J. R. R. Tolkien"), is(22.99f) );
-
If you've written a custom ObjectMapperFactory you need to change the signature of the
create
method. For example if you previously had a customJAXBObjectMapperFactory
that looked like this:public class MyJAXBObjectMapperFactory implements JAXBObjectMapperFactory { public JAXBContext create(Class cls, String charset) { ... } }
you now need to change it to:
public class MyJAXBObjectMapperFactory implements JAXBObjectMapperFactory { public JAXBContext create(Type cls, String charset) { ... } }
Note the change from
java.lang.Class
tojava.lang.reflect.Type
. This was needed for swagger integration.
See change log for more details.