Documente Academic
Documente Profesional
Documente Cultură
----------------------
* Fix duplication of content type in the Spring MockMvc module (thanks to Gemini
Kim for pull request)
* Fixed issue with overwriting FailureConfig on settings other configs (#1127)
(thanks to Victor Orlovsky for pull request)
* Added version range for the Groovy dependency for the osgi module to be between
2.4 and less than 2.5. This is because the API has changed in Groovy 2.5. (thanks
to Rikske54 for pull request)
* Fixed so that using a ResponseSpecBuilder doesn't overwrite the configured config
implicitly (issue 1128)
* Add Apache Johnzon object mapper support (thanks to Andriy Redko for pull
request)
* Add support for MatcherConfig in RestAssuredMockMvcConfig (#1071) (thanks to
Jurriaan Pruijs for pull request)
* Supported for logging when assertion errors thrown from internal matcher #1129
(thanks to Gemini Kim for pull request)
* Fixed so that there no longer are multiple versions of
org.springframework:spring-web:jar, leading to inconsistent semantic behaviors
(#1143) (thanks to HelloCoCooo for pull request)
* Fixed issues with the use of maven-bundle-plugin which created duplicate classes
in the distributed jar-files (#1117) (big thanks to Milen Dyankov, Steven Huypens
and Mark Kolich for the help!)
* Breaking changes introduced when solving #1117:
* io.restassured.mapper.TypeRef has been moved to
io.restassured.common.mapper.TypeRef
* io.restassured.mapper.DataToDeserialize has been moved to
io.restassured.common.mapper.DataToDeserialize
* io.restassured.mapper.ObjectDeserializationContext has been moved to
io.restassured.common.mapper.ObjectDeserializationContext
* io.restassured.mapper.factory.GsonObjectMapperFactory has been moved to
io.restassured.path.json.mapper.factory.GsonObjectMapperFactory
* io.restassured.mapper.factory.Jackson1ObjectMapperFactory has been moved to
io.restassured.path.json.mapper.factory.Jackson1ObjectMapperFactory
* io.restassured.mapper.factory.Jackson2ObjectMapperFactory has been moved to
io.restassured.path.json.mapper.factory.Jackson2ObjectMapperFactory
* io.restassured.mapper.factory.DefaultGsonObjectMapperFactory has been moved
to io.restassured.path.json.mapper.factory.DefaultGsonObjectMapperFactory
* io.restassured.mapper.factory.DefaultJackson1ObjectMapperFactory has been
moved to io.restassured.path.json.mapper.factory.DefaultJackson1ObjectMapperFactory
* io.restassured.mapper.factory.DefaultJackson2ObjectMapperFactory has been
moved to io.restassured.path.json.mapper.factory.DefaultJackson2ObjectMapperFactory
* io.restassured.mapper.resolver.ObjectMapperResolver has been moved to
io.restassured.common.mapper.resolver.ObjectMapperResolver
* io.restassured.exception.PathException has been moved to
io.restassured.common.exception.PathException
* Removed deprecated methods:
* io.restassured.RestAssured
* withArguments
* withNoArguments
* io.restassured.builder.ResponseSpecBuilder
* expectContent
* io.restassured.builder.RequestSpecBuilder
* setContent
* addParameters
* addParameter
* addQueryParameters
* addQueryParameter
* addFormParameters
* addFormParameter
* addPathParameter
* addPathParameters
* setAuthentication
* io.restassured.specification.ResponseSpecification
* content
* specification
* io.restassured.specification.RequestSpecification
* content
* formParameters
* formParameter
* pathParameter
* pathParameters
* authentication
* specification
* parameters
* parameter
* queryParameter
* queryParameters
* Deprecations
* Deprecated all short versions of "root", for example "root(..)",
"appendRoot(..)", "detachRoot(..)". Use "rootPath(..)", "appendRootPath(..)",
"detachRootPath(..)" instead. This was introduced for better consistency and
clearer intention..
* JsonPath#setRoot(..) - Use JsonPath#setRootPath(..) instead
* XmlPath#setRoot(..) - Use XmlPath#setRootPath(..) instead
* Rest Assured now requires Java 8 (previously Java 6 was required)
* Removed io.restassured.function.RestAssuredFunction - use
java.util.function.Function instead
* Made io.restassured.matcher.ResponseAwareMatcher a proper annotated functional
interface
* Made io.restassured.filter.Filter a proper annotated functional interface
* Made io.restassured.listener.ResponseValidationFailureListener a proper annotated
functional interface
* Made
io.restassured.module.mockmvc.intercept.MockHttpServletRequestBuilderInterceptor a
proper annotated functional interface
* Made io.restassured.path.json.mapping.JsonPathObjectDeserializer a proper
annotated functional interface
* Upgraded Groovy dependency from 2.4.15 to 2.5.6
* Removed io.restassured.response.ValidatableResponseOptions#specification(..), use
io.restassured.response.ValidatableResponseOptions#spec instead
* Removed io.restassured.response.ValidatableResponseOptions#content(..), use
io.restassured.response.ValidatableResponseOptions#body(..) instead
* Upgraded Hamcrest from version 1.3 to 2.1
* Made it possible to specify a multi-expectation body with arguments. For example:
when().
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)
* MockMvc module now supports using MediaType for Accept header value (issue
#1142). Thanks to Gemini Kim for pull request.
* Support for using "HttpStatus" when validating response status when using MockMvc
module. Thanks to Gemini Kim for pull request.
* MockMvc module now supports using MediaType for Accept header in
WebTestClientRequest. Thanks to Gemini Kim for pull request.
given().config(RestAssured.config().failureConfig(failureConfig().with().failureLis
teners((requestSpec, responseSpec, response) -> log.info("Rest Assured validation
failed!")).when(). ..
(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.
given().config(config().multiPartConfig(multiPartConfig().defaultBoundary("abcdef")
)). ..
(issue 670)
* Fixed an issue with path parameters where REST Assured would say that a path
parameter was not applied if the value was shorter than the template name in cases
where you had defined multiple templates between two slashes (issue 683)
* Fixed so that it's possible to declare whether or not XmlPath and Rest Assured
should use care about XML namespaces, validation and/or allow doc type declaration.
To configure this when using XmlPath do:
XmlPath xmlPath = new
XmlPath(xml).using(xmlPathConfig().namespaceAware(false)); // replace
"namespaceAware" with "validation" or "allowDocTypeDeclaration" if needed
And like this if using REST Assured DSL:
given().config(RestAssured.config().xmlConfig(xmlConfig().namespaceAware(false))).
..
* Deprecated com.jayway.restassured.filter.log.LogDetail#PATH since it actually
configured REST Assured to log the request URI and not only the path. Use
com.jayway.restassured.filter.log.LogDetail#URI instead (issue 687).
* Added NumberReturnType.BIG_INTEGER which allows you to configure JsonPath to
return non-decimal values as BigInteger (thanks to Jacob Krieger for pull request)
(issue 695)
* Upgraded spring-security from 4.0.2.RELEASE to 4.1.0.RELEASE in MockMvc module
(optional dependency)
* Upgraded spring from 4.2.0.RELEASE to 4.2.6.RELEASE in the MockMvc module
* Upgraded commons-lang3 from 3.3.2 to 3.4
* Improved proxy authentication to use Apache HTTP Client's built in features
(issue 693)
* Fixed NPE trying to close an empty response which was read as an inputstream
(issue 685)
* Added ability to remove headers from a filter by using the
FilterableRequestSpecification#removeHeader method (issue 539)
* Removed the following deprecated methods:
-
io.restassured.specification.AuthenticationSpecification.certificate(java.lang.Stri
ng, java.lang.String, java.lang.String, int) (use
io.restassured.specification.AuthenticationSpecification.certificate(java.lang.Stri
ng, java.lang.String, io.restassured.authentication.CertificateAuthSettings)
instead)
-
io.restassured.RestAssured.requestContentType(io.restassured.http.ContentType) (use
a io.restassured.builder.RequestSpecBuilder, set the content-type and apply it to
io.restassured.RestAssured.requestSpecification)
- io.restassured.RestAssured.responseContentType(java.lang.String) (Use
io.restassured.builder.ResponseSpecBuilder.expectContentType(io.restassured.http.Co
ntentType) and apply it to io.restassured.RestAssured.responseSpecification
instead)
-
io.restassured.config.EncoderConfig.appendDefaultContentCharsetToStreamingContentTy
peIfUndefined(java.lang.boolean) (use
io.restassured.config.EncoderConfig.appendDefaultContentCharsetToContentTypeIfUndef
ined(boolean) instead)
-
io.restassured.specification.FilterableRequestSpecification.getRequestContentType()
(use io.restassured.specification.FilterableRequestSpecification.getContentType()
instead)
- io.restassured.RestAssured.requestContentType() (If you really need to know
this then create a filter)
- io.restassured.RestAssured.responseContentType() (If you need to know this
then extract it from the response)
- io.restassured.RestAssured.certificate(java.lang.String, java.lang.String,
java.lang.String, int) (use
io.restassured.RestAssured.certificate(java.lang.String, java.lang.String,
io.restassured.authentication.CertificateAuthSettings) instead)
- io.restassured.filter.FilterContext.getRequestMethod() (use
io.restassured.specification.FilterableRequestSpecification.getMethod() instead)
- io.restassured.filter.FilterContext.getRequestPath() (use
io.restassured.specification.FilterableRequestSpecification.getDerivedPath()
instead)
- io.restassured.filter.FilterContext.getOriginalRequestPath() (use
io.restassured.specification.FilterableRequestSpecification.getUserDefinedPath()
instead)
- io.restassured.filter.FilterContext.getRequestURI() (use
io.restassured.specification.FilterableRequestSpecification.getURI() instead)
- io.restassured.filter.FilterContext.getCompleteRequestPath() (use
io.restassured.specification.FilterableRequestSpecification.getURI() instead)
- io.restassured.filter.log.LogDetail.PATH (use
io.restassured.filter.log.LogDetail.URI instead)
-
io.restassured.module.mockmvc.specification.MockMvcRequestSpecification.resultHandl
ers (use
io.restassured.module.mockmvc.response.ValidatableMockMvcResponse.apply(..)
instead)
- io.restassured.mapper.ObjectMapper.JACKSON (isn't needed anymore)
- io.restassured.mapper.ObjectMapper.GSON (isn't needed anymore)
- io.restassured.mapper.ObjectMapper.JAXB (isn't needed anymore)
- io.restassured.config.SSLConfig.getPassword() (use
io.restassured.config.SSLConfig.getKeyStorePassword() instead)
* Renamed method
com.jayway.restassured.specification.RequestLogSpecification.path(..) to
com.jayway.restassured.specification.RequestLogSpecification.uri(..)
* Added support for automatically recognizing content-type "text/json" as JSON
* Changed Maven groupId from com.jayway.restassured to io.rest-assured
* Changed package name from com.jayway.restassured to io.restassured
* Removed ability send requests directly from the response specification. This
means that you can't do for example "expect().get("/")" anymore. Use
"when().get("/")" instead.
* Changed io.restassured.specification.FilterableRequestSpecification.getMethod()
to return a String instead of an instance of io.restassured.http.Method since
custom HTTP verbs are now supported
* All HTTP verbs now support data in the body (for example TRACE, OPTIONS etc)
* Removed io.restassured.specification.RequestSpecification.then() since it's
confusingly similar to the "then" method in RequestSender. Use then "when" method
instead.
* You can now use custom http methods/verbs with REST Assured by making using the
the "request method" in the DSL (or from statically importing a
io.restassured.RestAssured.request(..)). For example:
when().request("CONNECT", "/somewhere").then().statusCode(200);
It you can also supply a predefined http method (defined in the
io.restassured.http.Method enum):
when().request(Method.GET, "/lotto").then().statusCode(200);
This API has also been implemented for the MockMvc module (but MockMvc doesn't
support arbitrary http methods as of now).
* Fixed so that query parameters are included in the request URI in the Spring
MockMvc module (issue 699) (thanks to lee myeong hyeon for pull request)
* Handles non-integer cookie versions in responses better (issue 701)
* Added ability to use ResponseAwareMatcher for headers. For example you can now
use attributes from the response body to validate a Location header.
Let's say that "/redirect" returns the json document { "id" : 1 } and returns a
redirect to a location ending with this id. If you want to validate the
Location header invariant you can do:
given().
redirects().follow(false).
when().
get("/redirect").
then().
statusCode(301).
header("Location", response ->
endsWith("/redirect/"+response.path("id")));
This has also been implemented for the MockMvc module (issue 692).
* Moved classes Cookie, Cookies, Header and Headers from package
com.jayway.restassured.response to io.restassured.http since they were used for
both requests and responses.
* Moved io.restassured.internal.mapper.ObjectMapperType to io.restassured.mapper
since ObjectMapperType should not be internal
* Deprecated all long versions "parameter" as well as "content". Here's a full
list:
io.restassured.builder.RequestSpecBuilder:
- io.restassured.builder.RequestSpecBuilder.setContent(byte[]) (use
io.restassured.builder.RequestSpecBuilder.setBody(byte[]) instead)
- io.restassured.builder.RequestSpecBuilder.setContent(java.lang.Object)
(use io.restassured.builder.RequestSpecBuilder.setBody(Object) instead)
- io.restassured.builder.RequestSpecBuilder.setContent(java.lang.Object,
io.restassured.mapper.ObjectMapper) (use
io.restassured.builder.RequestSpecBuilder.setBody(java.lang.Object,
io.restassured.mapper.ObjectMapper) instead)
- io.restassured.builder.RequestSpecBuilder.setContent(java.lang.Object,
io.restassured.mapper.ObjectMapperType) (use
io.restassured.builder.RequestSpecBuilder.setBody(java.lang.Object,
io.restassured.mapper.ObjectMapperType) instead)
- io.restassured.builder.RequestSpecBuilder.setContent(java.lang.Object,
io.restassured.mapper.ObjectMapperType) (use
io.restassured.builder.RequestSpecBuilder.setBody(java.lang.Object,
io.restassured.mapper.ObjectMapperType) instead)
- io.restassured.builder.RequestSpecBuilder.setContent(java.lang.String)
(use io.restassured.builder.RequestSpecBuilder.setBody(java.lang.String) instead)
- io.restassured.builder.RequestSpecBuilder.addParameter(java.lang.String,
java.util.Collection<?>) (use
io.restassured.builder.RequestSpecBuilder.addParam(java.lang.String,
java.util.Collection<?>) instead)
- io.restassured.builder.RequestSpecBuilder.addParameter(java.lang.String,
java.lang.Object...) (use
io.restassured.builder.RequestSpecBuilder.addParam(java.lang.String,
java.lang.Object...) instead)
- io.restassured.builder.RequestSpecBuilder.addParameters (use
io.restassured.builder.RequestSpecBuilder.addParams instead)
-
io.restassured.builder.RequestSpecBuilder.addFormParameter(java.lang.String,
java.util.Collection<?>) (use io.restassured.builder.RequestSpecBuilder.addParams
instead)
-
io.restassured.builder.RequestSpecBuilder.addFormParameter(java.lang.String,
java.lang.Object...) (use
io.restassured.builder.RequestSpecBuilder.addFormParam(java.lang.String,
java.lang.Object...) instead)
- io.restassured.builder.RequestSpecBuilder.addFormParameters (use
io.restassured.builder.RequestSpecBuilder.addFormParams instead)
-
io.restassured.builder.RequestSpecBuilder.addPathParameter(java.lang.String,
java.util.Collection<?>) (use io.restassured.builder.RequestSpecBuilder.addParams
instead)
-
io.restassured.builder.RequestSpecBuilder.addPathParameters(java.lang.String,
java.lang.Object, java.lang.Object...) (use
io.restassured.builder.RequestSpecBuilder.addPathParams(java.lang.String,
java.lang.Object, java.lang.Object...) instead)
- io.restassured.builder.RequestSpecBuilder.addPathParameters (use (use
io.restassured.builder.RequestSpecBuilder.addPathParams instead)
-
io.restassured.builder.RequestSpecBuilder.addQueryParameter(java.lang.String,
java.util.Collection<?>) (use io.restassured.builder.RequestSpecBuilder.addParams
instead)
-
io.restassured.builder.RequestSpecBuilder.addQueryParameter(java.lang.String,
java.lang.Object...) (use
io.restassured.builder.RequestSpecBuilder.addQueryParam(java.lang.String,
java.lang.Object...) instead)
- io.restassured.builder.RequestSpecBuilder.addQueryParameters (use
io.restassured.builder.RequestSpecBuilder.addQueryParams instead)
- io.restassured.builder.RequestSpecBuilder.setAuthentication (use
io.restassured.builder.RequestSpecBuilder.setAuth instead)
io.restassured.builder.ResponseSpecBuilder:
-
io.restassured.builder.ResponseSpecBuilder.expectContent(org.hamcrest.Matcher<?>)
(Use io.restassured.builder.ResponseSpecBuilder.expectBody(org.hamcrest.Matcher<?>)
instead)
-
io.restassured.builder.ResponseSpecBuilder.expectContent(java.lang.String,
org.hamcrest.Matcher<?>) (Use
io.restassured.builder.ResponseSpecBuilder.expectBody(java.lang.String,
org.hamcrest.Matcher<?>) instead)
-
io.restassured.builder.ResponseSpecBuilder.expectContent(java.lang.String,
java.util.List<io.restassured.specification.Argument>, org.hamcrest.Matcher<?>)
(Use io.restassured.builder.ResponseSpecBuilder.expectBody(java.lang.String,
java.util.List<io.restassured.specification.Argument>, org.hamcrest.Matcher<?>)
instead)
io.restassured.specification.RequestSpecification:
- io.restassured.specification.RequestSpecification.content(byte[]) (Use
io.restassured.specification.RequestSpecification.body(byte[]) instead)
- io.restassured.specification.RequestSpecification.content(java.io.File)
(Use io.restassured.specification.RequestSpecification.body(java.io.File) instead)
-
io.restassured.specification.RequestSpecification.content(java.io.InputStream) (Use
io.restassured.specification.RequestSpecification.body(java.io.InputStream)
instead)
-
io.restassured.specification.RequestSpecification.content(java.lang.Object) (Use
io.restassured.specification.RequestSpecification.body(java.lang.Object) instead)
-
io.restassured.specification.RequestSpecification.content(java.lang.Object,
io.restassured.mapper.ObjectMapper) (Use
io.restassured.specification.RequestSpecification.body(java.lang.Object,
io.restassured.mapper.ObjectMapper) instead)
-
io.restassured.specification.RequestSpecification.content(java.lang.Object,
io.restassured.mapper.ObjectMapperType) (Use
io.restassured.specification.RequestSpecification.body(java.lang.Object,
io.restassured.mapper.ObjectMapperType) instead)
-
io.restassured.specification.RequestSpecification.content(java.lang.String) (Use
io.restassured.specification.RequestSpecification.body(java.lang.String) instead)
- io.restassured.specification.RequestSpecification.authentication (Use
io.restassured.specification.RequestSpecification.auth instead)
-
io.restassured.specification.RequestSpecification.parameter(java.lang.String,
java.util.Collection<?>) (Use
io.restassured.specification.RequestSpecification.param(java.lang.String,
java.util.Collection<?>) instead)
-
io.restassured.specification.RequestSpecification.parameter(java.lang.String,
java.lang.Object...) (Use
io.restassured.specification.RequestSpecification.param(java.lang.String,
java.lang.Object...) instead)
-
io.restassured.specification.RequestSpecification.parameters(java.util.Map<java.lan
g.String,?>) (Use
io.restassured.specification.RequestSpecification.params(java.util.Map<java.lang.St
ring,?>) instead)
-
io.restassured.specification.RequestSpecification.parameters(java.lang.String,
java.lang.Object, java.lang.Object...) (Use
io.restassured.specification.RequestSpecification.params(java.lang.String,
java.lang.Object, java.lang.Object...) instead)
-
io.restassured.specification.RequestSpecification.formParameter(java.lang.String,
java.util.Collection<?>) (Use
io.restassured.specification.RequestSpecification.formParam(java.lang.String,
java.util.Collection<?>) instead)
-
io.restassured.specification.RequestSpecification.formParameter(java.lang.String,
java.lang.Object...) (Use
io.restassured.specification.RequestSpecification.formParam(java.lang.String,
java.lang.Object...) instead)
-
io.restassured.specification.RequestSpecification.formParameters(java.util.Map<java
.lang.String,?>) (Use
io.restassured.specification.RequestSpecification.formParams(java.util.Map<java.lan
g.String,?>) instead)
-
io.restassured.specification.RequestSpecification.formParameters(java.lang.String,
java.lang.Object, java.lang.Object...) (Use
io.restassured.specification.RequestSpecification.formParams(java.lang.String,
java.lang.Object, java.lang.Object...) instead)
-
io.restassured.specification.RequestSpecification.queryParameter(java.lang.String,
java.util.Collection<?>) (Use
io.restassured.specification.RequestSpecification.queryParam(java.lang.String,
java.util.Collection<?>) instead)
-
io.restassured.specification.RequestSpecification.queryParameter(java.lang.String,
java.lang.Object...) (Use
io.restassured.specification.RequestSpecification.queryParam(java.lang.String,
java.lang.Object...) instead)
-
io.restassured.specification.RequestSpecification.queryParameters(java.util.Map<jav
a.lang.String,?>) (Use
io.restassured.specification.RequestSpecification.queryParams(java.util.Map<java.la
ng.String,?>) instead)
-
io.restassured.specification.RequestSpecification.queryParameters(java.lang.String,
java.lang.Object, java.lang.Object...) (Use
io.restassured.specification.RequestSpecification.queryParams(java.lang.String,
java.lang.Object, java.lang.Object...) instead)
-
io.restassured.specification.RequestSpecification.pathParameter(java.lang.String,
java.lang.Object...) (Use
io.restassured.specification.RequestSpecification.pathParam(java.lang.String,
java.lang.Object...) instead)
-
io.restassured.specification.RequestSpecification.pathParameters(java.util.Map<java
.lang.String,?>) (Use
io.restassured.specification.RequestSpecification.pathParams(java.util.Map<java.lan
g.String,?>) instead)
-
io.restassured.specification.RequestSpecification.pathParameters(java.lang.String,
java.lang.Object, java.lang.Object...) (Use
io.restassured.specification.RequestSpecification.pathParams(java.lang.String,
java.lang.Object, java.lang.Object...) instead)
- io.restassured.specification.RequestSpecification.specification (Use
io.restassured.specification.RequestSpecification.spec instead)
io.restassured.specification.ResponseSpecification:
-
io.restassured.specification.ResponseSpecification#rootPath(java.lang.String) (Use
io.restassured.specification.ResponseSpecification.root(java.lang.String) instead)
-
io.restassured.specification.ResponseSpecification.rootPath(java.lang.String,
java.util.List<io.restassured.specification.Argument>) (Use
io.restassured.specification.ResponseSpecification.rootPath(java.lang.String,
java.util.List<io.restassured.specification.Argument>) instead)
- io.restassured.specification.ResponseSpecification.noRootPath (Use
io.restassured.specification.ResponseSpecification.noRoot instead)
-
io.restassured.specification.ResponseSpecification.content(java.util.List<io.restas
sured.specification.Argument>, org.hamcrest.Matcher, java.lang.Object...) (Use
io.restassured.specification.ResponseSpecification.body(java.util.List<io.restassur
ed.specification.Argument>, org.hamcrest.Matcher, java.lang.Object...) instead)
-
io.restassured.specification.ResponseSpecification.content(org.hamcrest.Matcher<?>,
org.hamcrest.Matcher<?>...) (Use
io.restassured.specification.ResponseSpecification.body(org.hamcrest.Matcher<?>,
org.hamcrest.Matcher<?>...) instead)
-
io.restassured.specification.ResponseSpecification.content(java.lang.String,
java.util.List<io.restassured.specification.Argument>, org.hamcrest.Matcher,
java.lang.Object...) (Use
io.restassured.specification.ResponseSpecification.body(java.lang.String,
java.util.List<io.restassured.specification.Argument>, org.hamcrest.Matcher,
java.lang.Object...) instead)
-
io.restassured.specification.ResponseSpecification.content(java.lang.String,
org.hamcrest.Matcher<?>, java.lang.Object...) (Use
io.restassured.specification.ResponseSpecification.body(java.lang.String,
org.hamcrest.Matcher<?>, java.lang.Object...) instead)
- io.restassured.specification.ResponseSpecification.specification (Use
io.restassured.specification.ResponseSpecification.spec instead)
io.restassured.RestAssured:
- io.restassured.RestAssured.withArguments (Use
io.restassured.RestAssured.withArgs instead)
- io.restassured.RestAssured.withNoArguments (Use
io.restassured.RestAssured.withNoArgs instead)
* Renamed the following methods:
- io.restassured.authentication.CertificateAuthSettings.keystoreType to
io.restassured.authentication.CertificateAuthSettings.keyStoreType
- io.restassured.authentication.CertificateAuthSettings.getKeystoreType to
io.restassured.authentication.CertificateAuthSettings.getKeyStoreType
- io.restassured.specification.RequestSpecification.keystore to
io.restassured.specification.RequestSpecification.keyStore
- io.restassured.RestAssured.keystore to io.restassured.RestAssured.keyStore
- io.restassured.builder.RequestSpecBuilder.setKeystore to
io.restassured.builder.RequestSpecBuilder.setKeyStore
* You can now do multipart file uploading for all HTTP verbs (even GET, OPTIONS
etc)
given().config(RestAssured.config().httpClientConfig(httpClientConfig().httpClientF
actory(new HttpClientConfig.HttpClientFactory() {
@Override
public HttpClient createHttpClient() {
return new SystemDefaultHttpClient();
}
}));
but now you can just use a lambda expression or method reference:
given().config(RestAssured.config().httpClientConfig(httpClientConfig().httpClientF
actory(SystemDefaultHttpClient::new));
* Fixed so that the "multiPart(String name, File file, String mimeType)" method
doesn't use default control name (issue 588)
* Added support for setting multipart filename when passing in an object to
multiPart method (issue 587)
* Multipart file-uploading now takes encoder config into account when serializing
content. For example if you're trying to serialize an object
using mime-type "application/vnd.ms-excel" in a multipart then you can register
that it should be serialize as JSON:
Greeting greeting = new Greeting();
greeting.setFirstName("John");
greeting.setLastName("Doe");
given().
config(config().encoderConfig(encoderConfig().encodeContentTypeAs("application/vnd.
ms-excel", ContentType.JSON))).
multiPart(new MultiPartSpecBuilder(greeting)
.fileName("RoleBasedAccessFeaturePlan.csv")
.controlName("text")
.mimeType("application/vnd.ms-excel").build()).
when().
post("/multipart/text").
then().
statusCode(200);
This will now serialize the "greeting" as JSON even though the mime-type is set
to "application/vnd.ms-excel" (which is unknown to REST Assured) (issue 586)
* You can now pass in which ObjectMapperType or ObjectMapper to use when
serializing an object using multipart. For example:
Greeting greeting = new Greeting();
greeting.setFirstName("John");
greeting.setLastName("Doe");
given().
multiPart(new MultiPartSpecBuilder(greeting, ObjectMapperType.GSON)
.fileName("RoleBasedAccessFeaturePlan.csv")
.controlName("text")
.mimeType("application/vnd.ms-excel").build()).
when().
post("/multipart/text").
then().
statusCode(200);
This will force the use if the GSON ObjectMapper (if available in the classpath)
even though mime type is not recognized by default by REST Assured.
* Charset for multipart requests is now taken into account
* Content-Type for multipart requests is now taken into account. For example you
can now do:
given().contentType("multipart/mixed").multiPart(..)
which was not possible in the previous version. (Only "multipart/form-data"
worked) (issue 586)
* It's now possible to specify default mime subtype for multipart content-type. Use
the MultiPartConfig#defaultSubtype(..) method.
Default is "form-data" which results in a content-type of "multipart/form-data".
This also works for the MockMvc module.
* Upgraded JUnit to 4.12
* Non-backward compatible change: Fixed so that GPath expressions using XML
namespaces are evaluated from the root.
The implementation was previously a misunderstanding of how the Groovy's
XmlSlurper worked when using namespace and has now been corrected. For example
let's say
you have a service at "/namespace-example" that returns the following XML:
<foo xmlns:ns="http://localhost/">
<bar>sudo </bar>
<ns:bar>make me a sandwich!</ns:bar>
</foo>
given().
config(newConfig().xmlConfig(xmlConfig().declareNamespace("ns",
"http://localhost/"))).
when().
get("/namespace-example").
then().
body("foo.bar.text()", equalTo("sudo make me a sandwich!")).
body(":foo.:bar.text()", equalTo("sudo ")).
body("foo.ns:bar.text()", equalTo("make me a sandwich!"));
Which was not correct (notice the missing foo property)! Big thanks to Erich
Eichinger for spotting this and providing a pull request (issue 592).
* Simplified setting of accept header in the MockMvc module (issue 591)
* It's now possible to use a mapping function when validating headers. For example
let's say you want to validate that the Content-Length header is less than 1000.
You can then use a mapping function to first convert the header value to an int
and then use an "integer" Hamcrest matcher:
when().get("/something").then().header("Content-Length", Integer::parseInt,
lessThan(1000));
This is also implemented for the MockMvc module (issue 594).
* Added new config called ParamConfig that allows you to configure how parameter
types should be updated. By default all parameters are merged so if you do:
given().queryParam("param1", "value1").queryParam("param1",
"value2").when().get("/x"). ...
REST Assured will send a query string of "param1=value1¶m1=value2". This is
not always what you want though so from now on you can configure REST Assured to
replace
values instead:
given().
config(config().paramConfig(paramConfig().queryParamsUpdateStrategy(REPLACE))).
queryParam("param1", "value1").
queryParam("param1", "value2").
when().
get("/x"). ..
REST Assured will now replace "param1" with "value2" (since it's written last)
instead of merging them together. You can configure the update strategy for each
parameter type of for all parameter types:
given().config(config().paramConfig(paramConfig().replaceAllParameters())). ..
This is also implemented for the MockMvc module (but the config there is called
MockMvcParamConfig) (issue 589)
* Non-backward compatible change: When multiple cookies or headers with the same
name are returned in the response the LAST value is what's returned when
only getting one value from the entity (Headers or Cookies) or when validating
values. For example let's say that the server returns headers:
HeaderName: Value 1
HeaderName: Value 2
then if you do:
get("/x").extract().header("HeaderName")
Value 2 will be returned (previous Value 1 would be returned).
Likewise if you do validation:
get("/x").then().header("HeaderName", equalTo("Value 2");
This change also affects session ids. This is done to be compatible with the way
browsers work (issue 543).
* Added ability to specify which encoder charset to use for a specific content-type
if no charset is defined explicitly for this content-type.
Previously you could only specify a default charset for ALL content-types. You do
this by using the "defaultCharsetForContentType" method in the
com.jayway.restassured.config.EncoderConfig. For example:
RestAssured.config =
config(config().encoderConfig(encoderConfig().defaultCharsetForContentType("UTF-
16", "application/xml")));
This will assume UTF-16 encoding for "application/xml" content-types that does
explicitly specify a charset.
By default "application/json" is now specified to use "UTF-8" as default content-
type as this is specified by RFC4627.
This is may be a backward incompatible change since previously "application/json"
content-types
were encoded using the platform default content-type (or what was specified by
defaultContentCharset(..)) (issue 567).
* Added ability to specify which decoder charset to use for a specific content-type
if no charset is defined explicitly for this content-type.
Previously you could only specify a default charset for ALL content-types. You do
this by using the "defaultCharsetForContentType" method in the
com.jayway.restassured.config.DecoderConfig. For example:
RestAssured.config =
config(config().decoderConfig(decoderConfig().defaultCharsetForContentType("UTF-
16", "application/xml")));
This will assume UTF-16 encoding for "application/xml" content-types that does
explicitly specify a charset.
By default "application/json" is now specified to use "UTF-8" as default charset
as this is specified by RFC4627.
This is may be a backward incompatible change since previously "application/json"
content-types
were encoded using the platform default content-type (or what was specified by
defaultContentCharset(..)).
* Fixed so that com.jayway.restassured.builder.ResponseBuilder register a
ResponseParserRegistrar by default to avoid NPE when logging custom built
responses.
* Fixed so that com.jayway.restassured.builder.ResponseBuilder now uses status code
as status line if no status line was explicitly defined.
* Added ability to set a header in com.jayway.restassured.builder.ResponseBuilder.
* Setting contentType in com.jayway.restassured.builder.ResponseBuilder also sets
the header.
* Added ability to pass a ContentType as argument to "setContentType" method in
com.jayway.restassured.builder.ResponseBuilder.
* Added a new module called spring-support that adds an alias to the "then" method
in Response or MockMvcResponse called "Then".
The reason for this is that "then" might be a reserved keyword in Scala in the
future and the compiler gives a warning when using "then".
To enable the use of "Then" simply import the
"com.jayway.restassured.module.scala.RestAssuredSupport.AddThenToResponse". For
example:
import com.jayway.restassured.RestAssured.when
import com.jayway.restassured.module.scala.RestAssuredSupport.AddThenToResponse
import org.hamcrest.Matchers.equalTo
import org.junit.Test
@Test
def `trying out rest assured in scala with implicit conversion`() {
when().
get("/greetJSON").
Then().
statusCode(200).
body("key", equalTo("value"))
}
This is also support for the spring-mock-mvc module.
Changelog 2.5.0 (2015-08-09)
-----------------------------
* MockMvc module now supports async requests. For example
"given().body(..).when().async().post("/x").then(). ..". Big thanks to Marcin
Grzejszczak (@mgrzejszczak) for helping out.
* Fixed NPE when using logging with a custom filter that doesn't include any
headers.
* REST Assured can now resolve multiple path parameters inside the same URI "path
parameter" (for example /somewhere/{x}{y}/z)
* Using non-deprecated DateUtils from Apache HTTP Client in CookieMatcher
* Quotations when extracting charset parameter is no longer required (thanks to
Ronny Bräunlich for pull request)
* Content specified with a content-type starting with "text/" or containing "+text"
is now automatically encoded as using the text encoder (issue 574)
* It's now possible to specify how content for a specific content-type should be
serialized using
com.jayway.restassured.config.EncoderConfig#encodeContentTypeAs(..).
For example let's say that you want to serialized content-type "my-custom-
content-type" as text:
given().
config(RestAssured.config().encoderConfig(encoderConfig().encodeContentTypeAs("my-
custom-content-type", ContentType.TEXT))).
contentType("my-custom-content-type").
content("Some text content").
when().
post("/somewhere"). ..
* Improved escaping of certain attributes (such as 'properties') when parsing JSON
and XML (issue 552)
* REST Assured now show all failing body assertions when using multiple
expectations in the same body clause. For example:
.. then().body("x.y", equalTo("z"), "y.z", is(2)). ..
If both "x.y" and "y.z" fails REST Assured will print both errors. Before only
the error of "x.y" was shown.
* Upgraded Groovy from 2.4.3 to 2.4.4
* Pretty-printing of JSON now displays unicode characters correctly (issue 556)
* Fixed so that the specified charset is actually used when calling
com.jayway.restassured.path.json.config.JsonPathConfig#charset(String)
* Fixed so that specifying number return type in
com.jayway.restassured.path.json.config.JsonPathConfig#numberReturnType(..) doesn't
override the other settings
* Added new a new NumberReturnType that can be used with JsonPathConfig in order to
always return non-integer numbers as doubles. This also you to for example use the
"closeTo" Hamcrest matcher. For example:
RestAssured.config =
RestAssured.config().jsonConfig(jsonConfig().numberReturnType(DOUBLE));
(issue 571)
* Upgraded optional Scribe dependency for OAuth2 authentication from version 1.3.5
to version 1.3.7.
* Possible to sign the request with an oauth2 access token (in the header) without
using Scribe (issue 509)
* Non-backward compatible change: Changed
com.jayway.restassured.matcher.ResponseAwareMatcher from an abstract class to a
(functional) interface.
The reason is to allow for creating ResponseAwareMatchers as lambda expressions
in Java 8. Before you had to do like this (even in Java 8):
when().
get("/game").
then().
body("_links.self.href", new ResponseAwareMatcher<Response>() {
public Matcher<?> matcher(Response response) {
return equalTo("http://localhost:8080/" + response.path("id"));
}
});
but with the new change you can now do (if using Java 8):
when().
get("/game").
then().
body("_links.self.href", response -> equalTo("http://localhost:8080/" +
response.path("id")));
which is much less verbose. This change should be backward compatible unless you
use composition of matchers. Before you composed ResponseAwareMatchers like this:
when().
get("/game").
then().
body("_links.self.href",
responseAwareMatcher1.and(responseAwareMatcher2));
This now longer works (since we cannot implement default methods in the
ResponseAwareMatcher interface in order to be compatible with older Java versions)
so now you use the new
com.jayway.restassured.matcher.ResponseAwareMatcherComposer class to compose
ResponseAwareMatchers instead:
when().
get("/game").
then().
body("_links.self.href", and(responseAwareMatcher1,
responseAwareMatcher2));
where "and" is statically imported from ResponseAwareMatcherComposer. These can
also be nested and combined with regular Hamcrest matchers, for example:
when().
get("/game").
then().
body("_links.self.href", and(responseAwareMatcher1,
containsString("something"), or(responseAwareMatcher2, responseAwareMatcher3,
endsWith("x"))));
(issue 575)
* Updated com.github.fge.json-schema-validator from version 2.2.5 to 2.2.6 in the
json-schema-validator module
* Non-backward compatible change: multiPart methods taking java.io.File as argument
now uses the filename of the File instead of just "file".
* Fixed a NPE when using ResponseBuilder without setting a status code.
* Multipart file uploading now supports specifying an empty filename.
* It's now possible to set default filename and control name for multiparts. Before
they were always equal to "file" but this is now configurable using the new
MultiPartConfig. For example:
given().config(config().multiPartConfig(multiPartConfig().with().defaultFileName("c
ustom1").and().defaultControlName("custom2"))). ..
This is also implemented for the Spring Mock MVC module.
* Upgraded Spring from version 4.1.6.RELEASE to 4.2.0.RELEASE in the spring-mock-
mvc module
* Upgraded Spring Security from version 3.2.5.RELEASE to 4.0.2.RELEASE in the
spring-mock-mvc module
* Added support for RequestPostProcessor authentication to the Spring Mock MVC
module. For example:
given().auth().with(httpBasic("username", "password")). ..
where "httpBasic" is statically imported from
org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostPro
cessors. This requires that you have "spring-security-test" in your classpath.
* Added support for RequestPostProcessors to the Spring Mock MVC module, for
example:
given().postProcessors(myRequestPostProcessor1, myRequestPostProcessor2). ..
* It's now possible to supply MockMvcConfigurers when calling webAppContextSetup in
the Spring Mock MVC module. For example:
given().webAppContextSetup(context, springSecurity()). ..
* Non-backward compatible change: The field "RestAssuredMockMvc.mockMvc" has been
replaced by a method: "RestAssuredMockMvc.mockMvc(..)". Before you did:
RestAssuredMockMvc.mockMvc = myMockMvcInstance;
but now you need to do:
RestAssuredMockMvc.mockMvc(myMockMvcInstance);
* Added RestAssuredMockMvc#config() method that returns the assign static config or
a new config if no static config has been assigned
* Spring Mock MVC module automatically registers
org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurer as
request post processor if spring-security-test is available in classpath.
This means that you don't have to create a custom MockMvc instance with a
"SecurityMockMvcConfigurer" manually which means easier setup.
* Added MockMvcConfig to RestAssuredMockMvcConfig which allows you to configure
whether or not SecurityMockMvcConfigurer should be applied by default (default is
true). To disable it use:
given().config(config().mockMvcConfig(mockMvcConfig().dontAutomaticallyApplySpringS
ecurityMockMvcConfigurer())). ..
* Added ability to supply an instance of MockMvcBuilder to the standaloneSetup
method in MockMvcRequestSpecification.
* Added support for standalone setup (setStandaloneSetup) and web app context setup
(setWebAppContextSetup) in MockMvcRequestSpecBuilder.
config(RestAssuredConfig.config().headerConfig(headerConfig().overwriteHeadersWithN
ame("header1"))).
header("header1", "value1").
spec(spec).
when().
get(..)
given().
config(config().sessionConfig(sessionConfig().sessionIdName("phpsessionid"))).
spec(spec).
..
when().
get(..)
This will now cause the resulting config to include both the header config and
session config. Before this change ONLY header config would be applied since all
configs from the specs were overwritten. This also applies to the MockMvc
extension.
* Upgraded Spring version for RestAssuredMockMvc from version 4.0.6.RELEASE to
4.1.2.RELEASE.
* Upgraded Groovy from version 2.3.6 to 2.3.7.
* Upgraded commons-fileupload for RestAssuredMockMvc from version 1.2.2 to version
1.3.1.
* Upgraded httpclient from version 4.3.5 to version 4.3.6.
* It's now possible to specify the SSLContext protocol when configuring
"relaxedHTTPSValidation" in SSLConfig. For example
sslConfig.relaxedHTTPSValidation("TLS"). Default is SSL just as in previous
versions. (issue 367).
* You can now send form parameters with a GET request in accordance with RFC1866
(page 46, HTML 4.x section 17.13.3). Form parameters will be added a query
parameters for a GET request and Content-Type will automatically be set to
"application/x-www-form-urlencoded" with the default charset.
* Added ability to log request method and request path. Use
"given().log().method()" and "given().log().path()" (issue 368).
get("/products").then().assertThat().body(matchesJsonSchemaInClasspath("products-
schema.json"));
(issue 284)
* Non-backward compatible change: Removed the following method from the RestAssured
API: "certificate(String certURL, String password, String certType, int port,
KeystoreProvider trustStoreProvider, boolean checkServerHostname)" and
"certificate(String certURL, String password, String certType, int port,
KeystoreProvider trustStoreProvider)".
* Deprecated the following method from the RestAssured API: "certificate(String
certURL, String password, String certType, int port)", "certificate(String certURL,
String password, String certType, int port, KeystoreProvider trustStoreProvider,
boolean checkServerHostname)". It's replaced by the "certificate(String certURL,
String password, CertificateAuthSettings certificateAuthSettings)" method. For
example:
RestAssured.authentication = certificate(certUrl, password,
certAuthSettings().with().port(435));
* Non-backward compatible change: Removed the following method from the
AuthenticationSpecification API: "certificate(String certURL, String password,
String certType, int port, KeystoreProvider trustStoreProvider, boolean
checkServerHostname)" and "certificate(String certURL, String password, String
certType, int port, KeystoreProvider trustStoreProvider)".
* Deprecated the following method from the AuthenticationSpecification API:
"certificate(String certURL, String password, String certType, int port)". It's
replaced by the "certificate(String certURL, String password,
CertificateAuthSettings certificateAuthSettings)" method. For example:
given().auth().certificate(certUrl, password,
certAuthSettings().with().port(435)). ..
* Added support for disabling hostname verification by disabling this using the
CertificateAuthSettings:
given().auth().certificate(certUrl, password,
certAuthSettings().with().allowAllHostnames(). ..
(issue 182)
* Non-backward compatible change: Removed static method "RestAssured.keystore()".
You can now get the keystore settings from the SSL configuration instead.
* Non-backward compatible change: Removed the
com.jayway.restassured.authentication.KeyStoreProvider interface. The
KeyStoreProvider was actually NOT used to create a KeyStore but rather a trust
store. To specify the trust store after this change use the SSLConfig or
certificate authentication.
* Non-backward compatible change: All keystore related methods in the RestAssured
API now returns void instead of KeyStoreSpec.
* You can now get the current REST Assured configuration by calling
RestAssured.config()
* Non-backward compatible change: Removed method "RestAssured.keyStore()". If you
want to get the configured "keystore" configuration you can now call
"RestAssured.config().getSSLConfig();".
given().config(newConfig().decoderConfig(decoderConfig().contentDecoders(DEFLATE)))
. ..
(issue 77)
* The http client instance can now be reused between REST Assured requests. By
default REST Assured creates a new instance for each "given" statement. To
configure reuse do the following:
RestAssured.config =
newConfig().httpClient(httpClientConfig().reuseHttpClientInstance());
* Added support for appending a root path to an existing root path using
"appendRoot" on the RequestSpecification, see javadoc for more info. (issue 248).
* Added support for resetting an already defined root by using "noRoot" on the
RequestSpecification, see javadoc for more info. (issue 248).
* Added the "given(requestSpecification)" method to the RestAssured API (issue 56).
* Added support for body expectations with empty path and only arguments, for
example expect().root("x.y.%s").body(withArgs("z"), equalTo("w")). .. (issue 265)
* Added support for body expectations without any arguments using withNoArgs() or
withNoArguments, for example:
expect().
root("store.%s", withArgs("book")).
body("category.size()", equalTo(4)).
appendRoot("%s.%s", withArgs("author", "size()")).
body(withNoArgs(), equalTo(4)).
when().
get("/jsonStore");
(issue 266)
* Added method "htmlPath" to REST Assured Response which allows you to easily get
values from an HTML page:
String pageTitle =
get("/index.html").htmlPath().getString("html.head.title");
(issue 268)
* Fixed an issue where a static preemptive basic authentication couldn't be
overridden by instance authentication (issue 233).
* Fixed an issue where multi-valued query parameters defined in the URL now works.
For example get("/x?y=1&y=2") (issue 169, 219).
* Improved request logging so that query parameters are included in the complete
path.
* Allow URLs that contains double slashes, for example
get("/x/y/http://localhost:8080")
* URL encoding (and disabling of URL encoding) has been completely re-written and
will now work better (issue 181).
* Fixed issues that made an incorrect port being used under certain conditions
(issue 217).
* Fixed so that Hamcrest's hasXPath() and not() can be combined (issue 215).
* Fixed a bug in XmlPathConfig when setting charset.
* It's now possible to use the Hamcrest XPath matcher with namespaces if XmlConfig
in REST Assured is configured to be namespace aware, e.g.
given().
config(newConfig().xmlConfig(xmlConfig().with().namespaceAware(true))).
expect().
body(hasXPath("/db:package-database", namespaceContext)).
when().
get("/package-db-xml");
(issue 39)
* Added possibility to add features to the javax.xml.parsers.DocumentBuilderFactory
instance used by REST Assured when parsing XML for XPath validation. Use the
XmlConfig to add achieve this.
* Namespaces are now included when pretty printing or logging XML.
* Added namespace support for body expectations if the namespace is declared
correctly, for example given the following XML:
<foo xmlns:ns="http://localhost/">
<bar>sudo </bar>
<ns:bar>make me a sandwich!</ns:bar>
</foo>
you can verify it like this:
given().
config(newConfig().xmlConfig(xmlConfig().declareNamespace("ns",
"http://localhost/"))).
expect().
body("bar.text()", equalTo("sudo make me a sandwich!")).
body(":bar.text()", equalTo("sudo ")).
body("ns:bar.text()", equalTo("make me a sandwich!")).
when().
get("/namespace-example");
(issue 39)
* XmlPath returned from REST Assured Response now takes features, namespaces,
charset etc into account.
* XmlPathConfig supports declaring namespaces which means that XmlPath is now
namespace aware if needed.
* Added ability to supply an XmlPathConfig instance when using the xmlPath() method
from a REST Assured Response object. For example :
XmlPath xmlPath = get("/namespace-
example").xmlPath(xmlPathConfig().with().declaredNamespace("ns",
"http://localhost/"));
* Non-backward compatible change: RestAssuredConfig no longer accepts a
JsonPathConfig, it now uses a JsonConfig object instead.
* Added ability to supply a JsonPathConfig instance when using the jsonPath()
method from a REST Assured Response object. For example :
JsonPath jsonPath = get("/namespace-
example").jsonPath(jsonPathConfig().with().numberReturnType(BIG_DECIMAL));
* Added peek and prettyPeek support to XmlPath which allows you to print the
content to system out but continue working with XmlPath afterwards (issue 271).
* Added peek and prettyPeek support to JsonPath which allows you to print the
content to system out but continue working with JsonPath afterwards (issue 272).
* FormAuthFilter is now added first to the filter chain.
* Added hasValue(..) method to com.jayway.restassured.filter.FilterContext.
* Added support for sessions by applying the
com.jayway.restassured.filter.session.SessionFilter, for example:
SessionFilter sessionFilter = new SessionFilter();
given().
auth().form("John", "Doe").
filter(sessionFilter).
expect().
statusCode(200).
when().
get("/formAuth");
given().
filter(sessionFilter). // Reuse the same session filter instance to
automatically apply the session id from the previous response
expect().
statusCode(200).
when().
get("/formAuth");
(issue 229, 273)
* Upgraded to Groovy 2.2.0
* Upgraded to Http Client 4.2.6
* Upgraded to Hamcrest 1.3 (issue 186)
given().config(newConfig().redirect(redirectConfig().followRedirects(false))). ..
or using a RequestSpecBuilder:
RequestSpecification spec = new
RequestSpecBuilder().setConfig(newConfig().redirect(redirectConfig().followRedirect
s(false))).build();
or for all requests:
RestAssured.config =
config().redirect(redirectConfig().followRedirects(true).and().maxRedirects(0));
"config()" and "newConfig()" can be statically imported from
com.jayway.restassured.config.RestAssuredConfig
* Non-backward compatible change: getRequestParams and getQueryParams() now returns
Map<String, ?> instead of Map<String, String> in FilterableRequestSpecification.
* Added getFormParams() and getPathParams() to
com.jayway.restassured.specification.FilterableRequestSpecification.
* Header- and Cookie names are now case-insentive in
com.jayway.restassured.response.Headers and
com.jayway.restassured.response.Cookies.
* Added a new method called filters(Filter filter, Filter...additionalFilter) in
the com.jayway.restassured.specification.RequestSpecification and
com.jayway.restassured.RestAssured.
* Logging has undergone a major uplift. You can now not only log the response body
but also headers, cookies and status line. You can also log the request details as
defined in the request specification. Thus the following:
given().log(). .. // Log the response body in versions prior to 1.5
and
expect().log(). .. // Also logs the response body in versions prior to 1.5
will now look like this:
given().log().body(). .. // Log the _request_ body in versions >= 1.5
and
expect().log().body() .. // Log the response body in versions >= 1.5
You can also log e.g. only headers in the request and the response:
given().log().headers(). .. // Log only the request headers
and
expect().log().headers(). .. // Log only the response headers
Previously there was a method called "logOnError" in both the request and
response specification. This has now been replaced with the following method in the
response specification:
expect().log().ifError(). ..
This change is not backward compatible (issue 81).
given().cookie(someCookie).and().expect().body(equalTo("x")).when().get("/cookie");
you can also send multiple detailed cookies at the same time:
Cookie cookie1 = Cookie.Builder("username", "John").setComment("comment
1").build();
Cookie cookie2 = Cookie.Builder("token", 1234).setComment("comment
2").build();
Cookies cookies = new Cookies(cookie1, cookie2);
given().cookies(cookies).then().expect().body(equalTo("username,
token")).when().get("/cookie");
(issue 99).
* Added support for mapping a path to a Java object in JsonPath, e.g: Book book =
from(JSON).getObject("store.book[2]", Book.class); (half of issue 125)
I.e. the indices 0 and 1 was replaced with a "%d" and you then supply the
arguments to the path expression using the "withArgs" method located in
com.jayway.restassured.RestAssured. You can also use the "withArgs" method without
using a root-path (issue 17, 80).
expect().
spec(responseSpec).
body("x.y.z", equalTo("something")).
when().
get("/something");
given().
spec(requestSpec).
expect().
body("x.y.z", equalTo("something")).
when().
get("/something");
* You can now get the response body content when request body is empty (issue 49).
* Added support for getting response body even when using body expecations. I.e.
now this works:
String body = expect().body("x.y.z",
equalTo("something")).when().get("/x").andReturn().body().asString(); (issue 50)
* Specifying a fully-qualied request url overrides default base path, base uri, and
port (issue 41).