forked from rest-assured/rest-assured
-
Notifications
You must be signed in to change notification settings - Fork 0
/
changelog.txt
1905 lines (1783 loc) · 158 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
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Changelog 4.5.1 (2022-02-11)
----------------------------
* Fixed a bug in ObjectMapper that required JAXB/JakartaEE when this was not intended (issue 1542)
Changelog 4.5.0 (2022-01-21)
----------------------------
* JAXB is now an optional dependency for XmlPath and is now longer required. Depend on 'jakarta.xml.bind:jakarta.xml.bind-api:2.3.3' and 'com.sun.xml.bind:jaxb-impl:2.3.3'
* Implemented support for serializing and deserializing with Jakarta EE 8 and 9. To use it you need to have Jakarta EE on the classpath, for example by depending on 'jakarta.xml.bind:jakarta.xml.bind-api:3.0.1' and 'org.glassfish.jaxb:jaxb-runtime:3.0.2'.
* Upgraded groovy from 3.0.8 to 3.0.9 (thanks to sullis for pull request)
* Added support for adding multiple LogDetails to the RequestLoggingFilter. You can now do e.g.:
given().filter(RequestLoggingFilter.with(LogDetail.METHOD, LogDetail.HEADERS, LogDetail.BODY)).when(). ..
Thanks to lucasnguyen17 for pull request.
* Fix default implementation of deprecated method detachRoot (#1503) (thanks to Guillaume Boucherie for pull request)
* Add on fail message builder for response specification (#1502). This means that you can no do:
when().
get().
then().
onFailMessage("Some specific message").
statusCode(200);
The "onFailMessage" will be shown in the error. This is good if you want to e.g. distinguish more easily between tests if they fail. (thanks to Victor Borovlev for pull request)
* Allow parsing responses with cookies that has numbers out of signed decimal range (#1069). This is a backward incompatible change if you're using the maxAge on "DetailedCookie" which now takes a long instead of an int. (thanks to Michał Radomyski for pull request)
* Upgraded the kotlin extension module to use Kotlin 1.6.10 instead of 1.5.0
* Introduced a rest-assured bom project for maven. Depend on 'io.rest-assured:rest-assured-bom:4.5.0' to use it. The bom contains configuration details for the rest-assured project that imports the correct dependencies (and versions) and to build your project. (thanks to George Gastaldi for pull request)
* Added "noContentType()" method to RequestSpecification which allows you to remove the content-type from the request if needed. For example:
given().
noContentType().
when().
post("/somewhere").
then().
statusCode(200);
(issue 1516)
* Removed accidental import of jdk.nashorn.internal.runtime.JSType.UNDEFINED_LONG from the Cookie class
Changelog 4.4.0 (2021-05-21)
----------------------------
* Upgrading kotlin extension module to use Kotlin 1.5.0 (previously 1.4.21 was used)
* Upgrading commons-io from 2.4.0 to 2.8.0
* Apache http client is upgraded from 4.5.3 to 4.5.13 (thanks to Daniel Reissenberger for pull request)
* Improved oauth compatibility with new http client
* Fixed a bug in EncoderConfig where user configured was accidentally set to true in default constructor
* Non-backward compatible change: REST Assured will no longer add "charset=utf-8" by default to application/json content-type's since this is not recommended by RFC 7159.
REST Assured will still automatically encode content as UTF-8, it's just that the charset is not added. To revert to the old behavior do:
RestAssured.config(RestAssured.config().encoderConfig(EncoderConfig.encoderConfig().defaultCharsetForContentType("UTF-8", "application/json")))
or specify the charset explicitly in the request:
given().contentType(ContentType.JSON.withCharset(UTF_8)). ..
(thanks to Michal Domagala for initial pull request)
* Added MULTIPART to as an option ContentType (thanks to Yusuf Tayman for pull request)
* Upgraded groovy from 3.0.7 to 3.0.8
Changelog 4.3.3 (2020-12-11)
----------------------------
* Upgrading kotlin extension module to use Kotlin 1.4.21 (previously 1.4.10 was used)
* Upgraded groovy from 3.0.6 to 3.0.7
* Ensure subclasses of ResponseOptions do not break Prettifier (#1425) (thanks to Sam Neirinck for PR)
Changelog 4.2.1 (2020-12-11)
----------------------------
* Backport of: Fix content type name before charset recognition (#1341)
Changelog 4.3.2 (2020-11-08)
----------------------------
* Upgrade json-schema-validator to 2.2.14 (issue 1397) (thanks to Guillaume Smet for PR)
* Upgrading apache commons lang3 from 3.4 to 3.11.
* Added asPrettyString method to ResponseBody (issue 1395) (thanks to GithubMood for PR)
* Describe non matching actual method with Hamcrest matcher format (issue 1387) (thanks for Ivo Šmíd for PR)
Before you could run into cryptic error messages such as:
JSON path values.pi doesn't match.
Expected: <3.14>
Actual: 3.14
Now, you see this instead:
JSON path values.pi doesn't match.
Expected: <3.14>
Actual: <3.14F>
* Upgraded groovy from 3.0.3 to 3.0.6
* Upgrading Kotlin extension module to use Kotlin 1.4.10 (previously 1.3.72 was used)
Changelog 4.3.1 (2020-07-03)
----------------------------
* Upgrading Kotlin extension module to use Kotlin 1.3.72 (previously 1.3.70 was used)
* Upgraded Groovy from 3.0.2 to 3.0.3
* Upgraded spring-security-core from 4.2.13.RELEASE to 4.2.17.RELEASE
* Fixed content type name before charset recognition (issue 1341) (thanks to jekanik for pull request)
* Removes dependencies javax.activation, com.sun.activation and org.apache.sling.javax.activation in favor of jakarta.activation (thanks to Geoffrey De Smet for pull request)
* Upgraded jackson-module-kotlin and jackson-core from 2.10.2 to 2.11.1
Changelog 4.3.0 (2020-03-13)
----------------------------
* Upgraded from Groovy 2.5.7 to Groovy 3.0.2
* Upgrading Kotlin extension module to use Kotlin 1.3.70 (previously 1.3.50 was used)
* Fixed so that DecoderConfig is properly set and used in the response in the Spring MockMvc module (thanks to dawiking for pull request)
* Fix jsonb serialization method in JsonbMapper (issue 1274) (thanks to Matthias for pull request)
* Fixed so that the predefined ResponseAwareMatchers "endsWithPath" and "startsWithPath" supports checking number properties
* Allow multipart uploads using PUT with Spring MockMvc (thanks to Ankit Tomar for pull request)
* Allow configuring CookieFilter (by using a new overloaded constructor) whether or not it should be allowed to specify multiple cookies with the same name (thanks to Ivo Šmíd for pull request)
Changelog 4.2.0 (2020-01-17)
----------------------------
* Jakarta EE API: switch from javax.xml.bind:jaxb-api to jakarta.xml.bind:jakarta.xml.bind-api (issue 1228) (thanks to Sanne Grinovero for pull request)
* Ignore unsupported by scripbejava verbs (thanks to Corneliu Duplachi for pull request)
* Add support for SameSite in Cookie (issue 1255) (thanks to Andreas Jonsson for pull request)
* Upgrading jackson2 from version 2.10.0 to 2.10.2
* Introduced the spring-mock-mvc-kotlin-extensions project which allows a nicer experience for Kotlin developers using the spring-mock-mvc module. This allows one to write tests like this:
class RestAssuredMockMvcKotlinExtensionsTest {
@Test
fun example() {
val mockMvc =
MockMvcBuilders.standaloneSetup(GreetingController())
.build()
val id: Int =
Given {
mockMvc(mockMvc)
param("name", "Johan")
} When {
get("/greeting")
} Then {
body(
"id", Matchers.equalTo(1),
"content", Matchers.equalTo("Hello, Johan!")
)
} Extract {
path("id")
}
assertThat(id).isEqualTo(1)
}
(thanks to Myeonghyeon-Lee for pull request)
* Added a new object mapper type that supports the Jakarta EE JSON Binding (JSON-B) specification. By default it will use Eclipse Yasson as the JSON-B implementation. To use it simply include
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>yasson</artifactId>
<version>${yasson.version}</version>
</dependency>
in your classpath and then configure REST Assured to use it as its default ObjectMapperType:
RestAssured.config = RestAssured.config.objectMapperConfig(ObjectMapperConfig.objectMapperConfig().defaultObjectMapperType(ObjectMapperType.JSONB));
(thanks to Andrew Guibert for pull request)
* Added ability to blacklist headers so that they are not shown in the request or response log. Instead the header value will be replaced with "[ BLACKLISTED ]". You can enable this per header basis using the LogConfig:
given().config(config().logConfig(logConfig().blacklistHeader("Accept"))). ..
The response log will the print:
Request method: GET
Request URI: http://localhost:8080/something
Proxy: <none>
Request params: <none>
Query params: <none>
Form params: <none>
Path params: <none>
Headers: Accept=[ BLACKLISTED ]
Cookies: <none>
Multiparts: <none>
Body: <none>
(thanks to Simone Ivan Conte for the help)
Changelog 4.1.2 (2019-10-02)
----------------------------
* The properties in a JSON document now preserves the order in which they are received (thanks to contextshuffling for pull request).
* Added "When" method to Kotlin extensions API for consistency. This means that you can now call "When" directly without using "Given":
When {
get("/greeting")
}
* Fixed so that it's possible to extract values after body validations in the Kotlin extensions API (issue 1212)
* Upgrading jackson2 from version 2.9.9 to 2.10.0
* Upgraded Groovy from version 2.5.6 to 2.5.8
* Support for Java 13 (enabled by groovy upgrade)
Changelog 4.1.1 (2019-09-06)
---------------------------
* Upgraded jaxb-api from 2.2.12 to 2.3.1
* Upgraded jaxb-osgi from 2.2.10 to 2.3.0.1
Changelog 4.1.0 (2019-09-02)
----------------------------
* Upgraded jackson2 from version 2.9.8 to 2.9.9 because of security issue in jackson-databind 2.9.8
* The ResponseBuilder now sets a default RestAssuredConfig instance when building responses from scratch. This is needed for example if extracting path's from the response.
* Added a Kotlin module that contains Kotlin extension functions that makes REST Assured nicer to work with from Kotlin. Depend on:
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>kotlin-extensions</artifactId>
<version>${rest-assured.version}</version>
<scope>test</scope>
</dependency>
and then import "Given" from the "io.restassured.module.kotlin.extensions" package. You can then use it like this:
val message: String =
Given {
port(7000)
header("Header", "Header")
body("hello")
} When {
put("/the/path")
} Then {
statusCode(200)
body("message", equalTo("Another World"))
} Extract {
path("message")
}
Besides a more pleasing API for Kotlin developers it also has a couple of major benefits to the Java API:
1. All failed expectations are reported at the same time
2. Formatting the code in your IDE won't mess up indentation
(issue 609)
* No longer depending on hamcrest-core or hamcrest-library, instead the hamcrest module is used directly.
* The scala support module has been upgraded to use Scala 2.13.0 (previously 2.12.7 was used)
* RequestSpecBuilder no longer sets 8080 port for non localhost uri (issue #1197) (thanks to dr29bart for pull request)
Changelog 4.0.0 (2019-05-10)
----------------------------
* 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.
* Upgraded spring-webmvc dependency from version 4.3.19.RELEASE to 4.3.23.RELEASE (issue #1161)
Changelog 3.3.0 (2019-01-11)
----------------------------
* Upgraded json-schema-validator from version 2.2.6 to 2.2.10 (thanks to thorin for pull request)
* Added io.restassured.mapper.TypeRef class that allows you to deserialize the response to a container with generic type. For example:
List<Map<String, Object>> products = get("/products").as(new TypeRef<List<Map<String, Object>>>() {});
Currently this only works for JSON :(
* Add logging functionality to the ResponseSpecBuilder, i.e. you can now do:
ResponseSpecification spec = new ResponseSpecBuilder().log(LogDetail.ALL).build();
(issue 579). Thanks to Aleksandr Podkutin for pull request!
* httpmime dependency is updated to version 4.5.3 and is now consistent with httpclient (thanks to Rüdiger Herrmann for pull request).
* Updated commons-fileupload from 1.3.1 to 1.3.3 to fix security issues
* Added a new artifact, rest-assured-all, which you can depend on instead of rest-assured to avoid split packages in Java 9+. (thanks to Tomasz Gaweda for pull request)
* Introduces custom listeners on test validation failures. This makes it possible to hook into Rest Assured and get a callback when the test fails with full access to the request/response specification
as well as the response. You can do this by implementing the "io.restassured.listener.ResponseValidationFailureListener" and add it to the new "FailureConfig". For example:
given().config(RestAssured.config().failureConfig(failureConfig().with().failureListeners((requestSpec, responseSpec, response) -> log.info("Rest Assured validation failed!")).when(). ..
(issue 1093) (thanks to Daniel Dyląg for pull request).
Changelog 3.2.0 (2018-10-19)
----------------------------
* Added OSGi support (thanks to ponziani for pull request)
* Make it clear that junit is only a test scope dependency (thanks to Eric Pabst for pull request)
* Changed MockMvcParamConfig.attributeUpdateStrategy() to actually return the attributeUpdateStrategy and not the formParamsUpdateStrategy.
* Added a spring-web-test-client module which let's you unit test Spring Webflux Controllers using the REST Assured DSL. Depend on artifact id "spring-web-test-client" using group id "io.rest-assured" from Maven to use it. Then use io.restassured.module.webtestclient.RestAssuredWebTestClient to get started (thanks to Olga Maciaszek-Sharma for pull request)
* Upgraded to from Groovy 2.4.12 to 2.4.15
* Upgraded Scala from version 2.11.12 to 2.12.7, this also means that the Scala support module now requires Java 8.
* Rest Assured now requires Java 6 (previously Java 5 was required).
* Moved XmlAssertion from io.restassured.assertion package to io.restassured.internal.path.xml since it's an internal class (issue 1051)
Changelog 3.1.1 (2018-08-17)
----------------------------
* Ensure RequestSpecBuilder picks up static config (issue 1012). (thanks to Peter Major for pull request)
* Support multiple 'Set-Cookie' headers in a response (issue 1016). (thanks to runtarinn for pull request)
* Fixed OAuth 1 for GET requests (thanks to Corneliu Duplachi for pull request)
* Add detailed cookie matching to RequestSpecBuilder (thanks to Peter Major for pull request)
* Add File Size to InputStreamEntity (issue 988) (thanks to vjykumar for pull request)
* Properly encodes JSON from InputStream (issue 1040) (thanks to Maksymilian Pawlak for pull request)
* Implemented ability to add headers to a multipart using the MultiPartSpecBuilder
Changelog 3.1.0 (2018-04-20)
-----------------------------
* Fixed generics handling of the detailed cookie matcher (thanks to Rafał Siwiec for pull request)
* Now using Type instead of Class in the API for mapping to Java Objects. For users of the REST Assured API the change is most prominent in the
"ResponseBodyExtractionOptions" interface where the "as" method now takes a "java.lang.Type" instead of "java.lang.Class". This should not cause
any backward incompatibilities. However this change also applies to ObjectMapperFactory's where there is a chance of backward incompatibilities
to arise. For example if you previously had a custom JAXBObjectMapperFactory that looked like this:
public class MyJAXBObjectMapperFactory implements JAXBObjectMapperFactory {
public JAXBContext create(Class cls, String charset) {
...
}
}
you now need to change it to:
public class MyJAXBObjectMapperFactory implements JAXBObjectMapperFactory {
public JAXBContext create(Type cls, String charset) {
...
}
}
(note the change from Class to Type). This was needed for swagger integration (issue 980). (thanks to Victor Orlovsky for pull request)
* Add better integration for standard HTTP methods with Apache HttpClient which also solves an issue content-type header being generated for empty GET requests (issue 974) (thanks to Daniel Dyląg for pull request)
* No longer using DEF_CONTENT_CHARSET from Apache HttpClient since it caused compatibility issues (issue 757)
* Fix for #979 Removing Authorization header when setting auth().none() (issue 979) (thanks to jovanovicivan for pull request)
* Fixed so that header equals is case-insensitive (issue 999) (thanks to Todd Bradley for pull request)
* Allow querying (extracting values out of) a request specification using the io.restassured.specification.SpecificationQuerier. For example:
RequestSpecification spec = ...
QueryableRequestSpecification queryable = SpecificationQuerier.query(spec);
String headerValue = queryable.getHeaders().getValue("header");
String param = queryable.getFormParams().get("someparam");
* Fixed so that it's possible to specify arguments to root paths in multi expectation blocks such as:
get("/jsonStore").then()
.root("store.book.find { it.author == '%s' }.price")
.body(
withArgs("Nigel Rees"), is(8.95f),
withArgs("Evelyn Waugh"), is(12.99f),
withArgs("Herman Melville"), is(8.99f),
withArgs("J. R. R. Tolkien"), is(22.99f)
);
* It's now possible to automatically include additional input fields when using form authentication. Just use the FormAuthConfig and specify the additional values to include using:
given().auth().form("username", "password", formAuthConfig().withAdditionalFields("firstInputField", "secondInputField"). ..
REST Assured will automatically parse the HTML page, find the values for the additional fields and include them as form parameters in the login request.
Changelog 3.0.7 (2018-02-09)
-----------------------------
* CookieFilter now conforms to RFC6265 standard by only copying expected cookies instead of all (thanks to Maciej Ciszewski for pull request) (issue 956).
* Prettifier can now prettify empty xml body (issue 960)
* Introduced a "detailed cookie matcher" that allows you to verify more detailed aspects of a cookie, for example:
given().
get("/multiCookie").
then()
cookie("cookie1", detailedCookie().maxAge(1234567));
(thanks to Rafał Siwiec for pull request)
Changelog 3.0.6 (2017-11-23)
-----------------------------
* Upgraded to Groovy 2.4.12
* REST Assured now works on Java 9
Changelog 3.0.5 (2017-10-05)
-----------------------------
* Reverted the API to take String instead of CharSequence again since this change introduced an accidental breaking change by not being binary compatible (only source compatible).
Changelog 3.0.4 (2017-10-05)
-----------------------------
* Changed API to take CharSequence instead of String. For example the "get" method in when().get("/something").. now takes a CharSequence instead of String (issue 858) (thanks to weaselmetal for pull request)
* Fixed so that assertions on content type with a ContentType.BINARY argument don't fail for binary content (issue 861) (thanks to Grégory Fouquet for pull request)
* Fixed an issue with two-way SSL whose root cause was Apache HTTP Client v4.5.2. Upgrading to 4.5.3 solved the issue (thanks to Ryan Tighe for pull request)
* Added support for ntlm authentication (issue 869) (thanks to Pawel Cesar Sanjuan Szklarz for pull request)
* Better support for empty GZIP responses (thanks to Sergey Trasko for pull request)
* Treat text/json as JSON content type (thanks to Ionuț Păduraru for pull request)
* RestAssured.oauth2("accessToken") now uses PreemptiveOAuth2HeaderScheme instead of OAuth2Scheme
* Added body params in OAuthRequest (issue 868) (thanks to Corneliu Duplachi for pull request)
* Set authentication once to set in SecurityContextHolder and Principal in method parameter in the MockMvc module (thanks to Leonard Siu for pull request)
* Allow passing multi-parts with content-types not starting with "multipart/" but also containing "multipart+" such as "application/x-hub-multipart+xml" (issue 919)
Changelog 3.0.3 (2017-05-05)
-----------------------------
* Fixed issue with multi-word parameters that were treated as a list (issue 787) (thanks to britka for pull request)
* Merges cookies of HttpServletResponse additionally to the Set-Cookie header (issue 791) (thanks to Andreas Gerstmayr for pull request)
* Removed second negative from exception message "... no supported Content-Type was not specified... " (thanks to Mark N Broadhead for pull request)
* Fixing EOFException for empty GZIP responses (issue 814)
* Update groovy version to fix memory leaks (issue 735) (thanks to Nikolai Gladkov for pull request)
* Improved cookie expiry parsing (issue 563) (thanks to Martin Aun for pull request)
* Improved multipart log output to make it prettier (thanks to Andrey Smirnov for pull request)
* Ignores spacing between content type and charset when validating content types (issue 804)
* Allow specifying default charset (only applicable when HttpMultipartMode is not STRICT) that'll be used when sending multiparts (issue 844)
Changelog 3.0.2 (2017-01-20)
-----------------------------
* Don't join root and path with '.' if path starts with array indexing (thanks to feshbach for pull request)
* Updated SSLConfig to allow keystore and truststore passwords to differ (thanks to mike42 for pull request)
* SSLConfig#getKeyStore() was returning trustStore rather than keyStore (thanks to mike42 for pull request)
* Added ability to get Cookies as a list (using Cookies#asList)
* Added new functionality to filters that allows removing and replacing headers and cookies.
* Fixed so that form parameters (i.e. String-values) does get merged correctly with the multipart parameters (issue 762) (thanks to Klaus Dorninger for pull request)
* Fixed so that the boundary of a request is set explicitly in the "Content-Type" header of the request (issue 762) (thanks to Klaus Dorninger for pull request)
* Fixed error message thrown by RestAssuredMockMvc that hinted at using the regular RestAssured API instead of the MockMvc variant (thanks to Toshiaki Maki for pull request)
* Fixed mismatch description from Hamcrest Matcher that previously was ignored for status codes (thanks to Javier Romero for pull request)
* Added support for ordered filters. Implement the io.restassured.filter.OrderedFilter interface and specify the precedence (thanks to jcravi for initial pull request).
* Fixed so that you can download binary data with the RestAssuredMockMvc module (thanks to Sergey Bespalov for pull request)
* Improved exception message when there's no supported (de-)serialization library in classpath (issue 788)
Changelog 3.0.1 (2016-09-02)
-----------------------------
* Fixed issues with colliding keys in multi-expectations for body and header validations. For example if "/x" returns the JSON { "x" : 2 } this would (previously) not throw an assertion error:
when().
get("/x").
then().
body("x", greaterThan(1),
"x", equalTo(5),
"x", lessThan(3));
The reason was the only the last first and last "x" expectation were taken into account (issue 714).
* Removed log.warn(..) messages from internal classes (issue 715)
* Cookie attributes are no longer sent in request in accordance with RFC6265. Thanks to Maciej Gawinecki for pull request. (issue 720)
* Mismatch description from TypeSafeDiagnosingMatcher is no longer ignored for when validating cookies. Thanks to Maciej Gawinecki for pull request. (issue 717)
* REST Assured no longer forces the use of the platform charset when parsing JSON as string when combined with expectations (issue 728)
* Don't append '.' to root path if given path starts with array indexing. Thanks to Tobias Johansson for pull request (issue 727).
* Removed the need for the cookie max age value to be greater than or equal to -1 (issue 732).
* Fixed memory leak in JSONAssertion. Big thanks to Andrey for pull request and investigation (issue 735).
* Releasing loaded classes in XmlAssertion after expression evaluation to reduce memory foot print.
Changelog 3.0.0 (2016-06-03)
-----------------------------
* Upgrading scribe dependencies to latest version 2.5.3 (thanks to Aniket for pull request)
* Added ability to specify an empty access token for OAuth1 authentication. Use com.jayway.restassured.config.OAuthConfig#addEmptyTokenToBaseString(boolean) to configure this.
* Allow to specify -1 as Cookie Max-Age in accordance with RFC 6265 (https://tools.ietf.org/html/rfc6265#page-20). Thanks to Timofey Dmitriev for pull request (issue 580).
* com.jayway.restassured.builder.RequestSpecBuilder#addMultiPart(MultiPartSpecification) is now public (issue 669)
* Support for setting session attributes in the Spring MockMvc module using the "sessionAttr" and "sessionAttrs" methods (thanks to sneyyar for pull request) (issue 671)
* It's now possible to map to java objects when extracting from a list in JsonPath. For example JsonPath.from(json).getList("store.books", Book.class).
* Added CookieFilter (com.jayway.restassured.filter.cookie.CookieFilter). The cookie filter can be used to keep track of all the cookies sent by the server and use
them in subsequent requests. It might come in handy when more than just com.jayway.restassured.filter.session.SessionFilter is needed. (thanks to Ranil Wijeyratne for pull request)
* It's now possible to pass a File to the body/content method of the RequestSpecification when content-type is set to JSON, XML or TEXT. The contents of this file will be sent to the server (issue 674)
* Fixed an issue where the Jackson and Jackson2 (Faster Jackson) object mappers didn't fully took charset into account when serializing POJO to String (issue 677).
* Added ability to instruct REST Assured whether or not to URL encode the request URI when it's presented in the request specification log.
This is configured using the com.jayway.restassured.config.LogConfig#urlEncodeRequestUri method. By default url encoding of the request uri is enabled to show what the URL targeted by REST Assured actually looks like for real.
But there may be cases where you want to make the URI more readable and this is when you might want to consider setting urlEncodeRequestUri to false (issue 678)
* Upgraded Groovy from 2.4.4 to 2.4.6
* Upgraded http-client from 4.5.1 to 4.5.2
* Improved JsonPath error messages when trying to verify a path with a parent that doesn't exist. For example if we have the following JSON document:
{ "myThing" : { "name" : "ThingName" } }
and we try to test it like so:
when().get("/thing").then().body("myThing1.name", equalTo("ThingName")); // Notice myThing1 is invalid
we now get an AssertionError like this:
1 expectation failed.
JSON path store.unknown.unknown.get(0) doesn't match.
Expected: (a collection containing "none")
Actual: null
whereas previously you would get an IllegalArgumentException with an error message like this:
Cannot get property 'name' on null object
(issue 668)
* Multipart uploads now take the content-type boundary into account. For example you can specify:
given().contentType("multipart/mixed; boundary=abcdef").multiPart(..). ..
which will use the specified boundary of "abcdef" instead of generating a "random" one. It's also possible to specify a default boundary
in the MultiPartConfig:
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.String, java.lang.String, java.lang.String, int) (use io.restassured.specification.AuthenticationSpecification.certificate(java.lang.String, 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.ContentType) and apply it to io.restassured.RestAssured.responseSpecification instead)
- io.restassured.config.EncoderConfig.appendDefaultContentCharsetToStreamingContentTypeIfUndefined(java.lang.boolean) (use io.restassured.config.EncoderConfig.appendDefaultContentCharsetToContentTypeIfUndefined(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.resultHandlers (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.lang.String,?>) (Use io.restassured.specification.RequestSpecification.params(java.util.Map<java.lang.String,?>) 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.lang.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<java.lang.String,?>) (Use io.restassured.specification.RequestSpecification.queryParams(java.util.Map<java.lang.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.lang.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.restassured.specification.Argument>, org.hamcrest.Matcher, java.lang.Object...) (Use io.restassured.specification.ResponseSpecification.body(java.util.List<io.restassured.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)
Changelog 2.9.0 (2016-03-04)
-----------------------------
* Added support for composing a Hamcrest matcher with a ResponseAwareMatcher when using a ResponseAwareMatcherComposer
* Automatically escapes JsonPath and XmlPath fragments that contains a hyphen and an index lookup operator. For example consider the following JSON document:
{ "some-list" : ["one", "two"] }
Previously you had to escape "some-list" manually if you wanted to get first element out of the list:
JsonPath jsonPath = ...
String firstElement = jsonPath.getString("'some-list'[0]"); // one
Now no explicit escaping is necessary:
String firstElement = jsonPath.getString("some-list[0]"); // one
But this means that if you previously had a JSON document like this:
{ "some-list[0]" : ["one", "two"] }
you would now have to escape it:
String firstElement = jsonPath.getString("'some-list[0]'[0]"); // one
which makes this an (unlikely but still) non-backward compatible change (issue 564).
* Added support for multipart DELETE requests (issue 634)
* It's now possible to use empty and whitespace path parameters (issue 631)
* Replace deprecated HttpEntity.consume with EntityUtils.consume to fix problems with connections not closing properly (issue 633) (thanks to Marin Dzhigarov and Julian Engelhardt for help and PR)
* Fixing NullPointerException for GET requests with an empty body (issue 642)
* Form authentication for fully-qualified URIs now uses the URI specified in the request instead of just localhost (issue 641)
* Improve escaping for XmlPath's containing colon. For example you can now do like this without manually having to escape anything in the path: "x:something.x:y[0]" (issue 647)
* Getting an attribute value from an XmlPath expression that doesn't exists now returns null instead of an empty list (issue 650).
* Deprecated com.jayway.restassured.config.SSLConfig#getPassword, use com.jayway.restassured.config.SSLConfig#getKeyStorePassword instead
* Major improvements of certificate authentication. You can now use a keystore (without trust store) and a keystore and trust store at the same time.
* Non-backward compatible change: keystore was previously used as a truststore. You must change "given().keystore(..)" to "given().trustStore(..)", "RestAssured.keystore(..)" to "RestAssured.trustStore(..)" and "SSLConfig.keystore(..)" to "SSLConfig.trustStore(..)". Sorry!
Changelog 2.8.0 (2015-12-18)
-----------------------------
* Modify HttpClientConfig so parameter methods respect previous configuration (issue 612). Thanks to Adam Clarkson for pull request.
* Fixed issue that caused filter context properties to be removed between filter invocations
* Added support for measuring time. For example:
long timeInMs = get("/lotto").time()
or using a specific time unit:
long timeInSeconds = get("/lotto").timeIn(SECONDS);
where "SECONDS" is just a standard TimeUnit. You can also validate it using the validation DSL:
when().
get("/lotto").
then().
time(lessThan(2000L)); // Milliseconds
or
when().
get("/lotto").
then().
time(lessThan(2L), SECONDS);
Please note that response time measurement should be performed when the JVM is hot! (i.e. running a response time measurement when only running a single test will yield erroneous results)
This is also implemented in the Spring MockMvc module (issue 493)
* Deprecated: com.jayway.restassured.filter.FilterContext#getRequestMethod, use com.jayway.restassured.specification.FilterableRequestSpecification#getMethod instead.
* Deprecated: com.jayway.restassured.filter.FilterContext#getRequestPath, use com.jayway.restassured.specification.FilterableRequestSpecification#getUserDefinedPath instead.
* Deprecated: com.jayway.restassured.filter.FilterContext#getRequestURI, use com.jayway.restassured.specification.FilterableRequestSpecification#getURI instead.
* Deprecated: com.jayway.restassured.filter.FilterContext#getOriginalRequestPath, use com.jayway.restassured.specification.FilterableRequestSpecification#getUserDefinedPath instead.
* Deprecated: com.jayway.restassured.specification.FilterableRequestSpecification#getRequestContentType, use com.jayway.restassured.specification.FilterableRequestSpecification#getContentType instead.
* Added com.jayway.restassured.http.Method enum that represents the various HTTP methods that may be used in REST Assured
* Added getUnnamedPathParams method to com.jayway.restassured.specification.FilterableRequestSpecification which returns all unnamed path parameters
* Added getUnnamedPathParamValues method to com.jayway.restassured.specification.FilterableRequestSpecification which returns all unnamed path parameter values
* Added getNamedPathParams method to com.jayway.restassured.specification.FilterableRequestSpecification which returns all named path parameters
* Non-backward compatible change: com.jayway.restassured.specification.FilterableRequestSpecification#getPathParams now returns both unnamed and named path parameters (before only named parameters were returned).
* com.jayway.restassured.specification.FilterableRequestSpecification#getQueryParams, getRequestParams, getFormParams and getPathParams now returns a Map of String -> String whereas before they returned a Map of String -> Object.
* It's now possible to change the request path from a filter, use the "path" method in the "requestSpec" (com.jayway.restassured.specification.FilterableRequestSpecification#path).
* You can now specify both named and unnamed path params at the same time
* Added ability to remove parameters from the FilterableRequestSpecification. Use the remove methods such as "removeQueryParam".
* Better error messages when unnamed path parameters are null.
* Slightly improved logging in Spring MockMvc module
* Removed the use of StandardCharset from DecoderConfig which prevented EncoderConfig to be used on Java 6 and older.
* Multipart patch no longer produces an exception on a call that returns status other than 200 (issue 615)
Changelog 2.7.0 (2015-10-31)
-----------------------------
* Significantly reduce sized of scala-support distribution package
* Removed the use of StandardCharset from EncoderConfig which prevented EncoderConfig to be used on Java 6 and older.
* Added support for sending a request body in a GET request (issue 544). Thanks to Manuel Möhlmann for pull request.
* Response content-type validation now works correctly even if the response body is empty (issue 566). Thanks to Manuel Möhlmann for pull request.
* Fixing dead links in javadocs (issue 605). Thanks to Ben Severson for pull request.
* Changes to com.jayway.restassured.filter.FilterContext:
1. getRequestPath now only returns the the actual path of the request URI (previously this returned the request URI) (non-backward compatible change)
2. getRequestURI returns the entire request URI (new method)
3. getCompleteRequestPath has been deprecated, use getRequestURI
4. getOriginalRequestPath has been added which returns the path of the request BEFORE path parameters have been applied to it
* Deprecated "resultHandlers" method in MockMvcRequestSpecification and added "apply" method to com.jayway.restassured.module.mockmvc.response.ValidatableMockMvcResponse that should be used instead.
For example previously you did "given().resultHandlers(print()).when().get("/x")" but now you do "get("/x").then().apply(print())" (issue 607)
* Automatically escapes "class" keyword in JsonPath and XmlPath (issue 598)
* Taking DecoderConfig into account when parsing non-string content (issue 599)
* It's now possible to supply MockMvcConfigurers when calling standaloneSetup in the Spring Mock MVC module. For example:
given().standaloneSetup(new Controller1(), springSecurity()). ..
* Automatically adds supports for spring rest docs path parameter documentation if spring-restdocs-mockmvc is in classpath. This can be disabled using the MockMvcConfig (issue 606).
* It's now possible to change port, base path etc from a filter (issue 600)
* Added support for specifying preemptive basic authentication for proxies. For example:
given().proxy(auth("username", "password")).when() ..
where "auth" is statically imported from com.jayway.restassured.specification.ProxySpecification (issue 597).
* Added getUUID method to JsonPath and XmlPath (thanks to Libor Ondrušek for the pull request)
Changelog 2.6.0 (2015-10-09)
-----------------------------
* Changed com.jayway.restassured.config.HttpClientConfig$HttpClientFactory from an abstract class to an interface in order to create it as a lambda express in Java 8. Before you had to do like this:
given().config(RestAssured.config().httpClientConfig(httpClientConfig().httpClientFactory(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().httpClientFactory(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>
You NOW test it like this:
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!"));
In the previous versions you did like this:
given().
config(newConfig().xmlConfig(xmlConfig().declareNamespace("ns", "http://localhost/"))).
when().
get("/namespace-example").
then().
body("bar.text()", equalTo("sudo make me a sandwich!")).
body(":bar.text()", equalTo("sudo ")).
body("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("custom1").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.SecurityMockMvcRequestPostProcessors. 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().dontAutomaticallyApplySpringSecurityMockMvcConfigurer())). ..
* 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.
Changelog 2.4.1 (2015-04-12)
----------------------------
* DefaultJackson2ObjectMapperFactory now scans and registers additional modules (issue 385)
* FilterableRequestSpecification#getPort now returns the correct port and not just -1.
* Upgraded to Groovy 2.4.3
* Upgraded Spring dependencies from 4.1.2.RELEASE to version 4.1.6.RELEASE in the Spring MockMvc module.
* REST Assured now allows specifying "File" and "InputStream" as request body.
* REST Assured MockMvc now allows specifying "File" as body.
Changelog 2.4.0 (2014-11-15)
-----------------------------
* The "matcherConfig" method in com.jayway.restassured.config.MatcherConfig is now static as intended.
* Fixed an issue in com.jayway.restassured.internal.path.xml.mapping.XmlPathJaxbObjectDeserializer that prevented parsing when XmlRootElement wasn't used.
* defaultContentCharset and defaultQueryParameterCharset in com.jayway.restassured.config.EncoderConfig now accepts a java.nio.charset.Charset as parameter (issue 363).
* com.jayway.restassured.config.DecoderConfig now accepts a java.nio.charset.Charset as parameter (issue 363).
* Content-Type expectations are now matched by using ignore case.
* Content-Type is now sent to the server if explicitly defined by a GET request (issue 362).
* Added syntactic sugar method "logRequestTo" to com.jayway.restassured.filter.log.RequestLoggingFilter as a shortcut for doing "new RequestLoggingFilter(printStream)".
* Default Content-Type charset is now visible in the request log.
* Default Content-Type charset is now appended to Content-Type header in Spring MockMvc module by default. Use "given().config(RestAssuredMockMvcConfig.config().encoderConfig(encoderConfig().appendDefaultContentCharsetToContentTypeIfUndefined(false))). .." to revert to previous behavior.
* PUT now uses content-type application/x-www-form-urlencoded by default when using form parameters.
* Content-Type is now correctly displayed in request log when not explicitly defined.
* Content-Type charset is now available in Filters when calling getRequestContentType() on the request specification.
* Deprecated RestAssured.responseContentType(..). Use com.jayway.restassured.builder.ResponseSpecBuilder#expectContentType(com.jayway.restassured.http.ContentType) and assign it to RestAssured.responseSpecification instead.