Update dependency io.rest-assured:rest-assured to v5 #61
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
This PR contains the following updates:
3.0.0->5.5.6Release Notes
rest-assured/rest-assured (io.rest-assured:rest-assured)
v5.5.6v5.5.5v5.5.4v5.5.3Greatly improved csrf support. When applying csrf, it'll automatically forward the cookies to returns from the GET request to the csrf token and apply it to the actual request. These cookies will also be applied to the CookieFilter automatically (if configured) and SessionFilter (if configured). For example:
given().
csrf("/login").
formParam("name", "My New Name").
when().
post("/users/123").
then().
statusCode(200);
Now the cookies returned from the GET request to login will be automatically applied to the POST to "/users/123".
If you have a CookieFilter defined for multiple requests, the cookies returned by GET to /login will be automatically stored in the CookieFilter and used in the second request.
You can disable this behavior by setting automaticallyApplyCookies to false the csrf config:
given().
config(config().csrfConfig(csrfConfig().automaticallyApplyCookies(false))).
csrf("/login").
when().
...
v5.5.2v5.5.1v5.5.0Removing custom validation of pathParams in the mock-mvc module and instead rely on the Spring implementation(issue 1782) (thanks to taeyeon-Kim for pull request)
Fixing "Error java.lang.NoSuchMethodError for HttpMethod.resolve()" in mock-mvc module (issue 1760) (thanks to d0vi for pull request)
Fix #1707: SVG file upload - fatal error :1:1: content is not allowed in prolog (#1777) (thanks to Byounghee kim for pull request)
Fix #1773: Remove check for response HTTP status code. (thanks to macmon for pull request)
Introducing the "scala-extensions" module for Scala 3 (#1770). This means that you can write tests like this in Scala 3:
@Test
def
extraction with rest assured scala extensions: Unit =val message: String = Given(req =>
req.port(7000)
req.header("Header", "Header")
req.body("hello")
)
.When(
_.put("/the/path")
)
.Extract(
_.path("message")
)
assertThat(message).isEqualTo("Hello World")
(thanks to Carlos Eduardo for pull request)
Remove deprecated Content-Transfer-Encoding from multipart post headers (#1762) (thanks to Michal Trna for pull request)
Fixed pathParams double encoding in mock-mvd module (#1756) (thanks to Dmitry Kaukov for pull request)
Upgraded Groovy from version 4.0.16 to 4.0.22
Upgraded Jackson from version 2.14.3 to 2.17.1
Upgraded kotlin extension module to use Kotlin 2.0.0 (previously 1.9.20 was used)
Upgraded Guava library from 32.0.1-jre to 33.2.1-jre
v5.4.0org.restassured:spring-web-test-client-kotlin-extensions:<version>you can write code like this for Spring WebTest client:val id: Int =
Given {
webTestClient(webTestClient)
param("name", "Johan")
} When {
get("/greeting")
} Then {
body(
"id", Matchers.equalTo(1),
"content", Matchers.equalTo("Hello, Johan!")
)
} Extract {
path("id")
}
v5.3.2onFailMessageafterthenlike:when().get("/somewhere").then().onFailMessage("My fail message").statusCode(200);(thanks to Ilya Koshaleu for pull request)v5.3.1v5.3.0v5.2.1v5.2.0Improved FilterContext used in Filters by adding the method FilterContext#hasValue(name, object). This makes it easier to check if a value exists and is equal to the expect object.
Introducing a much improved CSRF (cross-site request forgery) support. For example:
given().
csrf("/users").
formParm("firstName", "John").
formParm("lastName", "Doe").
when().
post("/users").
then().
statusCode(200);
This will first make a GET request to /users (due to csrf("/users")) to get an HTML page that contains the CSRF token.
Rest Assured will then automatically try to find the input field that contains the CSRF token and include in the POST to /users.
Here's an example of what Rest Assured expects as a response for the GET request to /users:
<title>Add User</title>Fixed so that form authentication takes CSRF into account. The previous form authentication CSRF implementation didn't really work (sorry!).
Now you can combine csrf with form authentication and it actually works as expected! Note that for requests other than GET or HEAD,
you need to specify both form authentication and csrf, e.g.
given().
csrf("/users").
formParm("firstName", "John").
formParm("lastName", "Doe").
auth().form("j_spring_security_check", "j_username", "j_password").
when().
post("/users").
then().
statusCode(200);
The reason for this is that the server returns a new CSRF token per request. So after the login request (with will use the CSRF token from the login page),
REST Assured needs to make an additional GET request to /users to get a new CSRF token. This token will then finally be supplied with the "POST" request
to "/users".
Adds support for Multipart upload via http PATCH method (thanks to Madis Liias for pull request)
Upgraded kotlin module to using Kotlin 1.7.10 (previously 1.6.21 was used)
v5.1.1v5.1.0Not all files have been moved yet, but refactoring will continue in the next release.
v5.0.1v5.0.0v4.5.1v4.5.0JAXB is now an optional dependency for XmlPath and is now longer required. Depend on 'jakarta.xml.bind:jakarta.xml.bind-api:2.3.3' and 'com.sun.xml.bind:jaxb-impl:2.3.3'
Implemented support for serializing and deserializing with Jakarta EE 8 and 9. To use it you need to have Jakarta EE on the classpath, for example by depending on 'jakarta.xml.bind:jakarta.xml.bind-api:3.0.1' and 'org.glassfish.jaxb:jaxb-runtime:3.0.2'.
Upgraded groovy from 3.0.8 to 3.0.9 (thanks to sullis for pull request)
Added support for adding multiple LogDetails to the RequestLoggingFilter. You can now do e.g.:
given().filter(RequestLoggingFilter.with(LogDetail.METHOD, LogDetail.HEADERS, LogDetail.BODY)).when(). ..
Thanks to lucasnguyen17 for pull request.
Fix default implementation of deprecated method detachRoot (#1503) (thanks to Guillaume Boucherie for pull request)
Add on fail message builder for response specification (#1502). This means that you can no do:
when().
get().
then().
onFailMessage("Some specific message").
statusCode(200);
The "onFailMessage" will be shown in the error. This is good if you want to e.g. distinguish more easily between tests if they fail. (thanks to Victor Borovlev for pull request)
Allow parsing responses with cookies that has numbers out of signed decimal range (#1069). This is a backward incompatible change if you're using the maxAge on "DetailedCookie" which now takes a long instead of an int. (thanks to Michał Radomyski for pull request)
Upgraded the kotlin extension module to use Kotlin 1.6.10 instead of 1.5.0
Introduced a rest-assured bom project for maven. Depend on 'io.rest-assured:rest-assured-bom:4.5.0' to use it. The bom contains configuration details for the rest-assured project that imports the correct dependencies (and versions) and to build your project. (thanks to George Gastaldi for pull request)
Added "noContentType()" method to RequestSpecification which allows you to remove the content-type from the request if needed. For example:
given().
noContentType().
when().
post("/somewhere").
then().
statusCode(200);
(issue 1516)
Removed accidental import of jdk.nashorn.internal.runtime.JSType.UNDEFINED_LONG from the Cookie class
v4.4.0Upgrading kotlin extension module to use Kotlin 1.5.0 (previously 1.4.21 was used)
Upgrading commons-io from 2.4.0 to 2.8.0
Apache http client is upgraded from 4.5.3 to 4.5.13 (thanks to Daniel Reissenberger for pull request)
Improved oauth compatibility with new http client
Fixed a bug in EncoderConfig where user configured was accidentally set to true in default constructor
Non-backward compatible change: REST Assured will no longer add "charset=utf-8" by default to application/json content-type's since this is not recommended by RFC 7159.
REST Assured will still automatically encode content as UTF-8, it's just that the charset is not added. To revert to the old behavior do:
RestAssured.config(RestAssured.config().encoderConfig(EncoderConfig.encoderConfig().defaultCharsetForContentType("UTF-8", "application/json")))
or specify the charset explicitly in the request:
given().contentType(ContentType.JSON.withCharset(UTF_8)). ..
(thanks to Michal Domagala for initial pull request)
Added MULTIPART to as an option ContentType (thanks to Yusuf Tayman for pull request)
Upgraded groovy from 3.0.7 to 3.0.8
v4.3.3v4.3.2Upgrade json-schema-validator to 2.2.14 (issue 1397) (thanks to Guillaume Smet for PR)
Upgrading apache commons lang3 from 3.4 to 3.11.
Added asPrettyString method to ResponseBody (issue 1395) (thanks to GithubMood for PR)
Describe non matching actual method with Hamcrest matcher format (issue 1387) (thanks for Ivo Šmíd for PR)
Before you could run into cryptic error messages such as:
Now, you see this instead:
Upgraded groovy from 3.0.3 to 3.0.6
Upgrading Kotlin extension module to use Kotlin 1.4.10 (previously 1.3.72 was used)
v4.3.1v4.3.0v4.2.1v4.2.0Jakarta EE API: switch from javax.xml.bind:jaxb-api to jakarta.xml.bind:jakarta.xml.bind-api (issue 1228) (thanks to Sanne Grinovero for pull request)
Ignore unsupported by scripbejava verbs (thanks to Corneliu Duplachi for pull request)
Add support for SameSite in Cookie (issue 1255) (thanks to Andreas Jonsson for pull request)
Upgrading jackson2 from version 2.10.0 to 2.10.2
Introduced the spring-mock-mvc-kotlin-extensions project which allows a nicer experience for Kotlin developers using the spring-mock-mvc module. This allows one to write tests like this:
class RestAssuredMockMvcKotlinExtensionsTest {
}
(thanks to Myeonghyeon-Lee for pull request)
Added a new object mapper type that supports the Jakarta EE JSON Binding (JSON-B) specification. By default it will use Eclipse Yasson as the JSON-B implementation. To use it simply include
org.eclipse yasson ${yasson.version}in your classpath and then configure REST Assured to use it as its default ObjectMapperType:
RestAssured.config = RestAssured.config.objectMapperConfig(ObjectMapperConfig.objectMapperConfig().defaultObjectMapperType(ObjectMapperType.JSONB));
(thanks to Andrew Guibert for pull request)
Added ability to blacklist headers so that they are not shown in the request or response log. Instead the header value will be replaced with "[ BLACKLISTED ]". You can enable this per header basis using the LogConfig:
given().config(config().logConfig(logConfig().blacklistHeader("Accept"))). ..
The response log will the print:
Request method: GET
Request URI: http://localhost:8080/something
Proxy:
Request params:
Query params:
Form params:
Path params:
Headers: Accept=[ BLACKLISTED ]
Cookies:
Multiparts:
Body:
(thanks to Simone Ivan Conte for the help)
v4.1.2When {
get("/greeting")
}
v4.1.1v4.1.0Upgraded jackson2 from version 2.9.8 to 2.9.9 because of security issue in jackson-databind 2.9.8
The ResponseBuilder now sets a default RestAssuredConfig instance when building responses from scratch. This is needed for example if extracting path's from the response.
Added a Kotlin module that contains Kotlin extension functions that makes REST Assured nicer to work with from Kotlin. Depend on:
io.rest-assured kotlin-extensions ${rest-assured.version} testand then import "Given" from the "io.restassured.module.kotlin.extensions" package. You can then use it like this:
val message: String =
Given {
port(7000)
header("Header", "Header")
body("hello")
} When {
put("/the/path")
} Then {
statusCode(200)
body("message", equalTo("Another World"))
} Extract {
path("message")
}
Besides a more pleasing API for Kotlin developers it also has a couple of major benefits to the Java API:
(issue 609)
No longer depending on hamcrest-core or hamcrest-library, instead the hamcrest module is used directly.
The scala support module has been upgraded to use Scala 2.13.0 (previously 2.12.7 was used)
RequestSpecBuilder no longer sets 8080 port for non localhost uri (issue #1197) (thanks to dr29bart for pull request)
v4.0.0when().
get("/jsonStore").
then().
rootPath("store.book.find { it.author == '%s' }").
body(
"price", withArgs("Nigel Rees"), is(8.95f),
"price", withArgs("Evelyn Waugh"), is(12.99f)
);
(issue #1154)
v3.3.0Upgraded json-schema-validator from version 2.2.6 to 2.2.10 (thanks to thorin for pull request)
Added io.restassured.mapper.TypeRef class that allows you to deserialize the response to a container with generic type. For example:
List<Map<String, Object>> products = get("/products").as(new TypeRef<List<Map<String, Object>>>() {});
Currently this only works for JSON :(
Add logging functionality to the ResponseSpecBuilder, i.e. you can now do:
ResponseSpecification spec = new ResponseSpecBuilder().log(LogDetail.ALL).build();
(issue 579). Thanks to Aleksandr Podkutin for pull request!
httpmime dependency is updated to version 4.5.3 and is now consistent with httpclient (thanks to Rüdiger Herrmann for pull request).
Updated commons-fileupload from 1.3.1 to 1.3.3 to fix security issues
Added a new artifact, rest-assured-all, which you can depend on instead of rest-assured to avoid split packages in Java 9+. (thanks to Tomasz Gaweda for pull request)
Introduces custom listeners on test validation failures. This makes it possible to hook into Rest Assured and get a callback when the test fails with full access to the request/response specification
as well as the response. You can do this by implementing the "io.restassured.listener.ResponseValidationFailureListener" and add it to the new "FailureConfig". For example:
(issue 1093) (thanks to Daniel Dyląg for pull request).
v3.2.0v3.1.1v3.1.0Fixed generics handling of the detailed cookie matcher (thanks to Rafał Siwiec for pull request)
Now using Type instead of Class in the API for mapping to Java Objects. For users of the REST Assured API the change is most prominent in the
"ResponseBodyExtractionOptions" interface where the "as" method now takes a "java.lang.Type" instead of "java.lang.Class". This should not cause
any backward incompatibilities. However this change also applies to ObjectMapperFactory's where there is a chance of backward incompatibilities
to arise. For example if you previously had a custom JAXBObjectMapperFactory 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 Class to Type). This was needed for swagger integration (issue 980). (thanks to Victor Orlovsky for pull 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 (issue 974) (thanks to Daniel Dyląg for pull request)
No longer using DEF_CONTENT_CHARSET from Apache HttpClient since it caused compatibility issues (issue 757)
Fix for #979 Removing Authorization header when setting auth().none() (issue 979) (thanks to jovanovicivan for pull request)
Fixed so that header equals is case-insensitive (issue 999) (thanks to Todd Bradley for pull request)
Allow querying (extracting values out of) a request specification 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");
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)
);
It's now possible to automatically include additional input fields when using form authentication. Just use the FormAuthConfig and specify the additional values to include using:
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.
v3.0.7given().
get("/multiCookie").
then()
cookie("cookie1", detailedCookie().maxAge(
1234567));(thanks to Rafał Siwiec for pull request)
v3.0.6v3.0.5v3.0.4v3.0.3v3.0.2v3.0.1when().
get("/x").
then().
body("x", greaterThan(1),
"x", equalTo(5),
"x", lessThan(3));
The reason was the only the last first and last "x" expectation were taken into account (issue 714).
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.