forked from rest-assured/rest-assured
/
changelog.txt
459 lines (432 loc) · 38.9 KB
/
changelog.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
Change log next version
-----------------------
* Fixed an issue with XmlPath when parsing xml attributes and using findAll.
* REST Assured now (finally) builds from Maven 3
* Explicitly registered custom parsers have precedence over default parsers (issue 183).
* It's now possible to manually set the content-type header, e.g. header("content-type", "something") now works (issue 155).
* ObjectMapper.JACKSON, ObjectMapper.GSON and ObjectMapper.JAXB have been deprecated. Use the corresponding types in enum com.jayway.restassured.mapper.ObjectMapperType instead.
* Added object mapping support for Jackson 2.0 (issue 189).
* Fixed an issue with the com.jayway.restassured.builder.ResponseBuilder that failed to clone the ResponseParserRegistrar.
* JSON path with digits separated by dots can now be processed by JsonPath (issue 195).
* Default filters accumulate and are not merged when reusing request specs (issue 197).
Change log 1.6.2 (2012-05-28)
-----------------------------
* You can now use all kinds of Collection instances (and not only List's as in the previous versions) as multi-value parameters (issue 165).
* The specified content-type header is no longer ignored when specifiying binary request body content (issue 167).
* REST Assured now closes the HTTP Client connection after each invocation (issue 168).
* JsonPath can now parse JSON documents with attribute names including dots and minus at the same time, e.g.
{ "a-b" : "minus" , "a.b" : "dot" , "a.b-c" : "both" }"
we can now get the result from "a.b-c" using:
from(json).get("'a.b-c'"); // Returns "both"
(issue 172).
* Fixed a NPE when getting the session id when no cookies were defined (issue 173).
* You can now serialize Java objects to JSON and XML in multi-part bodies. E.g.
given().multiPart("controlName", myJavaObject, "application/json"). ..
will serialize "myJavaObject" to a JSON string automatically (issue 166).
* Fixed a bug that prevented using a single named path parameter multiple times. I.e. this will now work:
given().
pathParam("firstName", "John").
expect().
body("fullName", equalTo("John John")).
when().
get("/{firstName}/{firstName}");
(issue 169).
* Fixed an issue with RestAssured.urlEncodingEnabled which didn't take request parameters into account when url encoding was disabled (issue 175).
Change log 1.6.1 (2012-04-05)
-----------------------------
* Default encoder is set to binary instead of url encoded. This means that when setting a binary body with an (by REST Assured) unrecognized content-type it will automatically be treated as an octet stream.
* Closed input stream when getting response body as byte-array (issue 163)
* Improved session support. You can now define a session id value in the DSL:
given().sessionId("1234"). ..
or for each request:
RestAssured.sessionId = "1234";
By default the session id name is JSESSIONID but you can change it using the SessionConfig:
RestAssured.config = newConfig().sessionConfig(new SessionConfig().sessionIdName("phpsessionid"));
RequestSpecBuilder has been improved to support session id's as well (issue 28).
* Added methods to the RequestSpecBuilder to enable adding cookies of type com.jayway.restassured.response.Cookie and com.jayway.restassured.response.Cookies.
* JRE proxy settings are now applied by default (thanks to Wolfram Kroll for the patch).
Change log 1.6 (2012-02-18)
---------------------------
* Forked HTTPBuilder. This means that a lot of workarounds that had to be made in the past can be removed in the future. It also means that the Groovy version is updated to version 1.8 and HTML parsing is greatly improved as well as many other minor changes and improvements (issue 112).
* The HTTP Delete method now supports a method body
* PUT request now work for multi part form data uploading
* Added support for pretty-printing the request and response body when logging if content-type is XML, JSON or HTML. Pretty-printing is enabled by default but it could be disabled either by:
RestAssured.config = config().logConfig(logConfig().enablePrettyPrinting(false));
or using the DSL:
expect().log.all(false). ..
You can also pretty-print the response from the Response object:
get("/some-xml").prettyPrint();
(issue 140)
* Fixed a serious issue with content-type validation, it was actually ignored in the previous versions (issue 146).
* XmlPath supports prettifying and pretty-printing XML and HTML, for example:
String prettyXml = with(someXml).prettify(); // Return a prettified XML string.
or print the XML to System.out and then return it:
String prettyXml = with(someXml).prettyPrint(); // Prints and returns a prettified XML string.
"with" is statically imported from com.jayway.restassured.path.xml.XmlPath (issue 147).
* JsonPath supports prettifying and pretty-printing JSON documents, for example:
String prettyJson = with(someJson).prettify(); // Return a prettified JSON string.
or print the JSON to System.out and then return it:
String prettyJson = with(someJson).prettyPrint(); // Prints and returns a prettified JSON string.
"with" is statically imported from com.jayway.restassured.path.json.JsonPath (issue 147).
* REST Assured now automatically detects content-types ending with +xml, +json and +html (for example application/something+json) and parses the content with the corresponding parser. This means that you don't need to register custom parsers for these kind of content-types (issue 142).
* Added support for using "bracket notation" for parsing unnamed JSON root arrays. For example consider the following JSON document:
[{"email":"name1@mail.com","alias":"name one","phone":"3456789"},
{"email":"name2@mail.com","alias":"name two","phone":"1234567"},
{"email":"name3@mail.com","alias":"name three","phone":"2345678"}]
and let's say you want to get the first e-mail. You can now do like this:
String email = from(jsonDocument).getString("[0].email");
(issue 148).
* Response cookies are no longer automatically set in subsequent requests by default. To re-enable this set the "http.protocol.cookie-policy" parameter in the HttpClientConfig to CookiePolicy.RFC_2109 (issue 149).
* Implemented support for no-value parameters, for example:
given().queryParam("someParameterName").when().get("/something");
This works for both "request parameters", query parameters and form parameters. (issue 143)
* Added support for getting integer JSON types without escaping, e.g. {"0":"value"} can now be parsed as ..body("0", equalTo("value"). (issue 150)
* REST Assured now takes the charset into consideration for both the request and the response. E.g.
given().contentType("application/xml; charset=US-ASCII").and().body("my body"). .. will encode the body as US-ASCII.
you can also specify the default charset for each request:
RestAssured.config = newConfig().encoderConfig(encoderConfig().defaultContentCharset("US-ASCII"));
(issue 132)
* Default content encoding charset has been changed from UTF-8 to ISO-8859-1 to comply with the RFC 2616. To change this use the EncoderConfig, e.g.
RestAssured.config = newConfig().encoderConfig(encoderConfig().defaultContentCharset("UTF-8"));
You can also specify the default query parameter charset.
* Default decoding content charset has been changed from platform default to ISO-8859-1 to comply with the RFC 2616. To change this use the DecoderConfig, e.g.
RestAssured.config = newConfig().decoderConfig(decoderConfig().defaultContentCharset("UTF-8"));
* Fixed a bug when setting content type to JSON and using a byte array as body (issue 156).
* Multi-headers and multi-cookie cookie parsing now uses ignore-case equals to identify the entity.
* Upgraded to Hamcrest 1.2.1 and changed the ResponseSpecification to allow for more flexible argument matchers.
* Fixed a bug with the cookie parsing which couldn't deal with cookie values including an equal character (issue 159).
* Added support for argument lists in root and rootPath methods in the response specification (issue 117).
* Request logging filter now logs base path and base uri (issue 145).
* Added method getCompleteRequestPath to com.jayway.restassured.filter.FilterContext. This method provides the fully-qualified URL including scheme and port number to the request path.
* Fixed content encoding for content types ending with +xml, +json and +html to automatically be encoded using the correct encoder methods (issue 160).
Change log 1.5 (2011-12-20)
---------------------------
* Added methods "noFilters" and "noFiltersOfType" to RequestSpecification to allow for removal of filters. This is useful when specifying a default filter statically (e.g. a custom authentication filter) but you need to remove it in a Filter implementation in order to make requests without this filter.
* Improved JsonPath to automatically convert e.g. ints to Strings if explicitly requested.
* Fixed an issue with detailed cookie parsing that prevent the "secured" attribute to be parsed correctly.
* Fixed a bug that failed to apply the root path for multi-body expectations, e.g this will now work:
expect().
root("store.book").
body(
"category.size()", equalTo(4),
"author.size()", equalTo(4)
).
when().
get("/jsonStore");
(issue 135)
* Fixed a bug with automatic port detection for certain base URI's.
* Improved merging of baseUri, basePath and path. E.g. if the baseUri ends with slash and the path starts with slash one of the slashes are automatically removed (issue 134).
* java.util.Locale will never be serialized to JSON/XML when provided in as a parameter object
* Fixed an issue with PUT method duplicating form parameters as query parameters (issue 137)
* Fixed so that JSON path fragments starting with @ are escaped automatically (issue 138).
* Fixed a serious bug in the response parsing which ignored changes made to the response from a filter when using the DSL (issue 139).
* Created a ResponseBuilder to make it easier to create new Response implementations. This is useful if you're working with filters and want to change the response you get from the sever somehow. E.g.
Response myResponse = new ResponseBuilder().clone(originalResponse).setBody("Something").build();
* Allows configuring redirect settings using the DSL, e.g.
given().redirects().max(12).and().redirects().follow(true).when(). .. (issue 24)
* Support for passing in a keystore located on the file-system, e.g.
given().keystore(new File(".."), "password"). ..
or for all requests:
RestAssured.keystore(new File(".."), "password"). ..
You can also specify the path to the file system as a string as well:
given().keystore("some/path/my_keystore.jks", "password"). ..
In this case REST Assured will first try to find the keystore in the classpath but if it was not found it will look in the file-system (issue 136).
* Status code and status line are now validated before headers and cookies (issue 131).
* Quotes from strings in error messages has been removed.
* Added possibility for more some more advanced configuration by providing a RestAssuredConfig instance. Right now you can configure the parameters of HTTP Client, Redirect and Log settings. Examples:
For a specific request:
given().config(newConfig().redirect(redirectConfig().followRedirects(false))). ..
or using a RequestSpecBuilder:
RequestSpecification spec = new RequestSpecBuilder().setConfig(newConfig().redirect(redirectConfig().followRedirects(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).
Change log 1.4.5 (2011-11-08)
-----------------------------
* REST Assured can now parse responses with no-value (empty) cookies (issue 124).
* Added support for serializing objects to a parameter if the content-type is set:
given().
contentType("application/json").
queryParam("category", "Games").
formParam("object", new GameObject(..)). // GameObject will be serialized to JSON
when().
post("/somewhere");
(issue 127).
* Fixed a bug with multi-value form parameters when using PUT.
* You can now create multi-value headers using e.g.: given().header("headerName", "value1", "value2")... This will create TWO headers, "headerName=value1" and "headerName=value2".
* You can now create multi-value cookies using e.g.: given().cookie("cookieName", "value1", "value2")... This will create TWO cookies, "cookieName=value1" and "cookieName=value2".
* Fixed a bug in the specification merger which caused FormAuthFilters to be applied twice if using multiple specifications with form auth.
* Fixed a serious bug in the cookie response parsing that caused cookie attributes to be parsed as a new cookie (issue 130).
* This version introduces a number of non-backward compatible change: The headers() and getHeaders() methods in com.jayway.restassured.response.Response no longer return a Map of key-value pairs, it now returns an instance of com.jayway.restassured.response.Headers. The reason for this is to allow for multi-value headers. These are headers that has several values for the same header name, e.g. "headerName=value1" and "headerName=value2". See javadoc in com.jayway.restassured.response.Headers for more info.
* Added support for getting "detailed cookies". A detailed cookie contains information such as Expiry Date, Path, Version etc. To get a detailed cookie use com.jayway.restassured.response.Response#getDetailedCookie(<cookie name>) or to get all use com.jayway.restassured.response.Response#getDetailedCookies().
* Added support for sending detailed cookies, e.g.
Cookie someCookie = new Cookie.Builder("some_cookie", "some_value").setSecured(true).build();
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)
Change log 1.4 (2011-10-07)
---------------------------
* Better error message when an actual JSON or XML path value doesn't match the expected value (issue 104).
* Removed dependency to spring-web in example project
* Improved support for getting a list with an explicit type using XmlPath (issue 106).
* RestAssured.baseURI now works as expected. You can now use e.g. RestAssured.baseURI = "http://somehost.org:1234" and the subsequent requests will automatically go to that URI as base (issue 54).
* Rest Assured now throws a java.lang.AssertionError instead of AssertionFailedException (issue 100).
* Added support for setting a default Parser. This parser will automatically be used to parse all responses whose content-type doesn't match a pre-defined parser. You can set the default parser for all responses using:
RestAssured.defaultParser = Parser.JSON;
or for a single response:
expect().defaultParser(Parser.JSON).when(..).
or using a response specification builder:
new ResponseSpecBuilder().setDefaultParser(Parser.JSON).build();
(issue 107).
* Improved parsing of response content. If no body expectations are defined then the content is no longer encoded to an intermediate data structure when calling methods such as "asString", "asByteArray" etc on the Response object. This increases the performance of Rest Assured when using no body expectations (e.g. get("/something").asString()) (issue 109).
* Added an "asInputStream" to the Response object. This means that you can now do e.g. "get("/something").asInputStream()" to get the body returned as an input stream.
* Support for mapping a response content body directly to an Object using either Jackson or Gson for JSON responses and JAXB for XML responses. Usage example:
SomeObject someObject = get("/something").as(SomeObject.class);
This requires the the response content-type is defined. If you want to map the response using a specific object mapper you can do like this:
SomeObject someObject = get("/something").as(SomeObject.class, ObjectMapper.GSON);
Note that Rest Assured doesn't explicitly depend on any of the object mappers so you need to add them to the classpath manually or using a Maven dependency (issue 19).
* Support for mapping a Java Object to JSON or XML using Jackson, Gson or JAXB. Use e.g. "given().contentType("application/json").and().body(someObject).when().post("/something");"
You can also specify an explicit object mapper instead of a content-type:
given().body(someObject, ObjectMapper.JACKSON).when().post("/something");
(issue 118).
* getMap with explicit type now converts the key and value to the defined type for both JsonPath and XmlPath
* JsonPath.getList with an explicit type now converts all list members to the defined type (issue 114).
* Fixed a bug when defining root path that ends with a dot and a path that starts with a dot.
* You can now provide ints, floats etc to the request body. E.g. given().body(42).when().post("/somewhere");
* getString in JsonPath converts the result to string if needed (issue 115).
* Added "path", "jsonPath" and "xmlPath" methods to ResponseBody object. This make it very convenient to make a request and parse a single path from the response. E.g.
String messageBody = get("/message").path("message.body");
In this example the response content-type determines whether JsonPath or XmlPath should be used. It could also be defined explicitly:
String messageBody = get("/message").jsonPath().getString("message.body");
(issue 110, 116).
* Fixed a bug when using a form auth per request and a default form auth which added two form auth filters to the filter list causing multiple requests to made to the server.
Change log 1.3.1 (2011-09-20)
-----------------------------
* Fixed a trivial bug in the error message that is displayed when no parser is found for a certain content type (issue 103).
* Fixed a bug that caused the response body to be parsed as JSON if Content-Type of the response was JSON even though no body matchers were specified (issue 102).
* Improved List parsing with XmlPath. E.g. from(XML).getList("shopping.category.item.price") will now automatically convert the output from NodeChildren to a List. Also from(XML).getList("shopping.category.item.price", Float.class) will automatically convert all list members to floats.
* When result from XmlPath expression is a single entity it's treated as a list if explicitly defined: E.g. from(XML).getList("shopping.category.item.price[0]") and from(XML).get("shopping.category.item.price.list()") will return a list (issue 59).
* All parameter values now take Object as parameter type. This means that you can supply e.g. ints, floats etc and not only Strings as parameter values. E.g. before you had to do given().param("number", String.valueOf(1)).when().get(..) but now you can simply do given().param("number", 1).when().get(..); (issue 82).
* You can now register custom parsers directly in the response specification and the response specification builder and not only statically in the RestAssured class. E.g. expect().parser("some/xml", Parser.XML).when().get("/something"); (issue 101).
Change log 1.3 (2011-09-05)
---------------------------
* Added support for uploading files, input streams, byte arrays and text using multi-part form data upload. You can use the "multiPart" method to specify what to upload. E.g.
given().multiPart(new File("/home/user/myFile.txt").when().post("/upload"); (issue 93)
* Request specification details such as port number are now taking into account when using form authentication (issue 95).
* You can now pass string data to the content method in the RequestSpecification, e.g. given().content("{ \"message\" : \"hello world
\"}").then().expect().statusCode(200).when().post("/json");
* Added methods to get NodeChildren and Node to XmlPath class (issue 54 and 58).
* Improved automatic escaping of attributes in cases of ranges. E.g. you can now type "records.car[0..1].@year" when parsing XML instead of having to escape the year attribute like "records.car[0..1].'@year'".
* Improved escaping of the minus character inside closures when parsing JSON, XML and HTML.
* When using XmlPath and getting primitive values from an XML graph the result is automatically converted to the expected primitive type if needed and possible.
* Added support for depth-first parsing of XML using the double-star notation, e.g. "int chocolatePrice = from(XML).getInt("shopping.**.find { it.name == 'Chocolate' }.price");" (issue 94).
* RestAssured now uses the threads classloader to load net.sf.json.AbstractJSON instead of root classloader to avoid problems with Groovy Grape (issue 92).
* When specifying a request body and using a custom/unregistered content-type the body will automatically be URL Encoded. Previously a NPE was thrown because no content encoder was registered to HTTP Builders encoder registry for the specified content type. (issue 96).
* Fixed a bug in RequestSpecificationBuilder that treated form parameters as query parameters.
Change log 1.2.3 (2011-08-18)
-----------------------------
* Fixed a bug when using PUT with multi-value form parameters.
* Improved path parameter support. Rest Assured no longer URL encodes path parameters in order to detect them as query parameters.
* JsonPath now converts from Groovy primitives to Java primitives correctly (thanks to Erik Hjortsberg)
* Added support for enabling and disabling URL encoding for parameters. This is useful if the parameters are URL encoded before you supply them to Rest Assured. In cases like this you need to use given().urlEncodingEnabled(false), RestAssured.urlEncodingEnabled = false or specify it using the RequestSpecificationBuilder to avoid double URL encoding (issue 88).
* Fixed URL to web page in pom.xml (issue 90)
* Added a no-argument get method to JsonPath and XmlPath to easier parse the entire object graph (issue 91).
* Better support for re-usable path expressions by using arguments. E.g. let's say you want to expect a complex path like this:
expect().
body("filters.filterConfig[0].filterConfigGroups.find { it.name == 'GroupName' }.includes", hasItem("first")).
body("filters.filterConfig[1].filterConfigGroups.find { it.name == 'GroupName' }.includes", hasItem("second")).
..
The only difference between the two body paths is the index of the "filterConfig". A root path wouldn't help since previously you could only append a path to the root path and not supply arguments to it. Now you can do:
expect().
root("filters.filterConfig[%d].filterConfigGroups.find { it.name == 'GroupName' }.includes").
body("", withArgs(0), hasItem("first")).
body("", withArgs(1), hasItem("second")).
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).
Change log 1.2.2 (2011-06-28)
-----------------------------
* Added support for parsing an entire JSON graph. E.g. let's say you have a JSON snippet like this:
[{"email":"name1@mail.com","alias":"name one","phone":"3456789"},
{"email":"name2@mail.com","alias":"name two","phone":"1234567"},
{"email":"name3@mail.com","alias":"name three","phone":"2345678"}]
You can then parse the entire JSON snippet to a List of Map like this:
List<Map<String, String>> result = from(json).get("$");
or
List<Map<String, String>> result = from(json).get("");
(issue 78)
* Added support for explicitly specifiying form parameters, e.g. using given().formParam("name", "value"). This is useful e.g. when sending a PUT request with both form params and query params (issue 75).
* It's now possible to check that a header does NOT exist: expect().header("someheader", nullValue()). (issue 74).
* Support for path parameters. E.g. get("/{firstName}/{lastName}", "John", "Doe") will send a GET request to "http://localhost:8080/John/Doe". You can also specify path params like this:
given().
pathParam("firstName", "John").
pathParam("lastName", "Doe").
when().
get("/{firstName}/{lastName}");
(issue 36)
* Support for specifying a Java keystore when using SSL. This is useful when you run into e.g. SSLPeerUnverifiedException when the server has an invalid certificate. Usage:
given().keystore("/pathToJksInClassPath", <password>)
For more info refer to http://groovy.codehaus.org/modules/http-builder/doc/ssl.html (issue 79).
* Fixed an issue that could cause parameters to be treated as lists parameters.
Change log 1.2.1 (2011-05-23)
-----------------------------
* Fixed an issue when defining default request specifications with form parameters when using POST.
* Added support for getting the content type in the com.jayway.restassured.response.Response object.
* Fixed a major issue with filters that caused the response expecations to be verified before filter chain was completed.
* Added "from" method to XmlPath and JsonPath (issue 60).
* XmlPath now supports parsing HTML by setting CompatibilityMode to HTML, e.g. new XmlPath(CompatibilityMode.HTML, <some html>);.
* Form authentication now uses HTML parsing when parsing the login page (before XML parsing was used which was very fragile).
* Improved HTML parsing with Groovy closures
Change log 1.2 (2011-05-22)
---------------------------
* Better support for multi-value parameters. You can now defined them using a List:
with().param("list", asList("1", "2", "3)). ..
or with var-args:
with().param("list", "1", "2", "3). ..
* Added support for form authentication: given().auth().form("username", "password")... Rest Assured will automatically parse the login page and try to find the form action and the username and password input fields. If it fails to do so or if you want a faster request you can supply a FormAuthConfig as a third param that providers Rest Assured with these parameters. E.g. given().auth().form("username", "password", new FormAuthConfig(..)).. There's a pre-defined form auth config for Spring Security: given().auth().form("username", "password", FormAuthConfig.springSecurity())... You can also specify form as default authentication for all requests: RestAssured.authentication = form("username", "password");. (issue 61).
* Added support for filters with which you can inspect and alter a request before it's actually committed and also inspect and alter the response before it's returned to the expectations. You can regard it as an "around advice" in AOP terms. Filters can be used to implement custom authentication schemes, logging, session management etc. You implement com.jayway.restassured.filter.Filter and register it using: given().filter(new MyFilter()). .. or set it as default: RestAssured.filters(asList(new MyFilter()); (issue 71).
* You can now define and expect cookies without values using e.g. given().cookie("some_cookie").. or expect().cookie("some_cookie").. (issue 69).
* You can now specify default request and response content type using RestAssured.requestContentType(..) and RestAssured.responseContentType(..). (issue 68).
* Support for specifying string content types (issue 72).
* Support for specifying default request and response specifications (issue 67).
* Added support for printing response body using filters. E.g. given().filter(ErrorLogger.errorLogger()).. will print the response body if an error occurred (400 <= status code <= 500). You can also use the ResponseLoggingFilter to print response bodies for all status codes: given().filter(ResponseLoggingFilter.loggingFilter()).., or you can make it print only for specific status codes: given().filter(ResponseLoggingFilter.logResponseIfStatusCodeIs(302)).. and you can even use Hamcrest matchers: given().filter(ResponseLoggingFilter.logResponseIfStatusCodeIs(greaterThan(200)))..
There's also a shortcut for error logging:
given().logOnError(). or expect().logOnError(). ..
and for logging:
given().log(). or expect().log(). (issue 66).
* Added support for easily printing the response after a request (if the expectations pass), e.g. expect().body("greeting", equalTo("Greetings John Doe")).when().get("/greet?firstName=John&lastName=Doe").print();
Change log 1.1.7 (2011-04-26)
-----------------------------
* Added support for mixing form and query parameters when using the POST method. E.g. "with().param("firstName", "John").and().queryParam("lastName", "Doe").expect().body("greeting.lastName", equalTo("Doe")).post("/greetXML");"
When using POST the "param" method adds form parameters to the request and "queryParam" adds query parameters of the request.
* Added support for multi-value paramters, e.g. with().param("list", "first").and().param("list", "second").when().get("/something") will now send a GET request to "/something" with parameter list including first and second. (issue 62).
Change log 1.1.6 (2011-03-29)
-----------------------------
* Preemptive basic authentication really works (issue 52).
Change log 1.1.5 (2011-03-28)
-----------------------------
* Added suport for preemptive basic authentication. E.g. given().auth().preemptive().basic("username", "password").when().get("/secured");. You can also set preemptive basic authentication as default authentication scheme using:
RestAssured.authentication = preemptive().basic("username", "password"); (issue 45)
* Added support for specifying a root path. E.g. instead of writing:
expect().
body("x.y.firstName", is(..)).
body("x.y.lastName", is(..)).
body("x.y.age", is(..)).
body("x.y.gender", is(..)).
when().
get("/something");
you can use a root path and do:
expect().
rootPath("x.y").
body("firstName", is(..)).
body("lastName", is(..)).
body("age", is(..)).
body("gender", is(..)).
when().
get("/something");
You can also set a default root path using: RestAssured.rootPath = "x.y"; (issue 47)
* It's now possible to reuse specifications accross different tests (issue 46). E.g.
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(200).expectBody("x.y.size()", is(2)).build();
expect().
spec(responseSpec).
body("x.y.z", equalTo("something")).
when().
get("/something");
The "responseSpec" can now be reused in a completely different test without having to duplicate the expecations in the "responseSpec" for each test.
The same thing can be achieved for request specifications:
RequestSpecification requestSpec = new RequestSpecBuilder().addParameter("parameter1", "value1").build();
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).
Change log 1.1.2 (2011-03-04)
-----------------------------
* Fixed so that POST requests can return a response (e.g. Response response = post("/somewhere");) when an error occurred (status code 400 to 999). (issue 37).
* You can now get the status line and status code from the Response (issue 40). E.g
Response" response = get("/something");
String statusLine = response.getStatusLine();"
* Corrected some javadoc issues.
Change log 1.1.1 (2011-03-02)
-----------------------------
* Added support for getting headers and cookies from the Response, e.g. String headerValue = get("/something").andReturn().header("headerName"); (issue 27)
* Fixed so that you don't need to add a "@" when calling getAttribute(..) on Node in XmlPath (issue 34)
* Added support for validating XML body using XSD e.g. "expect().body(matchesXsd(xsd)).when().get("/carRecords");" where matchesXsd(..) is a REST-Assured Hamcrest matcher located in com.jayway.restassured.matcher.RestAssuredMatchers and "xsd" can be either a String, InputStream, Reader, URL or File (issue 29).
* Added support for validating XML body using DTD e.g. "expect().body(matchesDtd(dtd)).when().get("/videos");" where matchesDtd(..) is a REST-Assured Hamcrest matcher located in com.jayway.restassured.matcher.RestAssuredMatchers and "dtd" can be either a String, InputStream, URL or File (issue 29).
* Improved error messages on illegal paths when expecting XML (issue 35).
Change log 1.1 ((2011-02-18)
----------------------------
* Added support for specifying base path using "RestAssured.basePath = /resource". E.g. let's say that the base URI is http://localhost and base path is "/resource" will make create a request to "http://localhost/resource/something" when doing a 'get("/something")'. Default value is empty. (issue 13)
* Support for specifying request/query parameters in the url, e.g. get("/something?param1=first¶m2=second"). (issue 23)
* Fixed a bug in RestAssuredResponse parser that caused a NPE when the input stream was null. (issue 25)
* Major improvements to XML expecations. It now uses Groovy syntax for the expectation string to allow for much better expectations! Note that this fix will break backward compatibility on some expectations. E.g. given
<greeting>
<name>
<firstName>John</firstName>
<lastName>Doe</lastName>
</name>
</greeting>
you used to do:
expect().body("greeting.name", hasItems("John", "Doe"))..
Now this will not work, instead you have to do:
expect().body("greeting.name.children()", hasItems("John", "Doe"))..
But this also means that you can do:
expect().body("greeting.name.size()", equalsTo(2))..
See http://groovy.codehaus.org/Updating+XML+with+XmlSlurper for more info about the syntax.
* Support for expecting on XML attributes, e.g. expect().body("greeting.name.@firstName", equalTo("John")).when().get("/greetXMLAttribute?firstName=John&lastName=Doe");
* When forcing plain text verification for e.g. JSON or XML responses the response content type is no longer changed. Before this could cause Jersey to refuse to refuse the return a response. (issue 10)
* PUT requests now supports specifying binary a request body
* Major improvements to JSON expectations. It now uses Groovy syntax for the expectation string to allow for much better expectations! Note that this fix will break backward compatibility on some expectations.
- JSON lists are always returned as Java lists which means that you should use the hasItem(..) hamcrest matcher and not hasItemsInArray(..) hamcrest matcher.
* Added support for specifying default authentication scheme. E.g. use RestAssured.authentication = basic("username", "password") to cause all subsequent request to use basic authentication. You can reset to no authentication using RestAssured.reset(); (issue 20)
* Added support for registering a predefined parser for unsupported mime-types by using RestAssured.registerParser(<mime-type>, <parser>). E.g. to register that mime-type 'application/vnd.uoml+xml' should be parsed using the XML parser do: RestAssured.registerParser("application/vnd.uoml+xml", Parser.XML);. You can also unregister a parser using RestAssured.unregisterParser("application/vnd.uoml+xml");. (issue 8)
* Added XmlPath object which allows you to parse an XML response from a request easily. E.g.
String xml = post("/greeting").asString();
String firstName = with(xml).get("greeting.firstName");
For more information refer to the javadoc of com.jayway.restassured.path.xml.XmlPath
* Added JsonPath object which allows you to parse an JSON response from a request easily. E.g.
String json = post("/greeting").asString();
String firstName = with(json).get("greeting.firstName");
For more information refer to the javadoc of com.jayway.restassured.path.json.JsonPath
Change log 1.0.3 (2011-01-17)
-----------------------------
* Fixed a bug in the JSON parsing which prevent parsing of nested arrays (issue 15)
* Added support for getting an index in a JSON array. E.g. expect().body("items.get(0)", equalTo("firstIndex")).when().get("/something");. Assuming that "items" is an array then "items.get(0)" returns the first element in that array.
* Fixed so that you can expect on null values in JSON arrays.
* Request senders can now return the body as byte array or string. E.g. get("/something").asString() makes GET request to "/something" and returns the response body as a string. This is useful if you want to debug the response while creating your test or if you want to use third-party tools to validate the response. Note that it only works if you don't specify any expectations before making the request.
Change log 1.0.2 (2011-01-12)
-----------------------------
* JSON and XML matching now supports many more content types than before. Before you could only use XML matching for content type application/xml and JSON for application/json.
* Support for HTML verification
* Support for RSS verification (content type application/rss+xml)
Change log 1.0.1 (2010-12-27)
-----------------------------
* Refactored AuthenticationSpecification to be a Java interface in order to avoid Groovy methods being exposed and to allow for Javadoc.