request may contain additional request cookies, as shown in the following example:
Groovy DSL.
+
org.springframework.cloud.contract.spec.Contract.make {
+ request {
+ //...
+
+ // Each Cookies is added in form `'Cookie-Key' : 'Cookie-Value'`.
+ // there are also some helper methods
+ cookies {
+ cookie 'key': 'value'
+ cookie('another_key', 'another_value')
+ }
+
+ //...
+ }
+
+ response {
+ //...
+ }
+}
+
YAML.
+
request:
+...
+cookies:
+ foo: bar
+ fooReq: baz
request may contain a request body:
Groovy DSL.
org.springframework.cloud.contract.spec.Contract.make {
request {
@@ -525,7 +558,7 @@ following code shows an example:
Groovy DSL.
response:
...
status: 200
-
Besides status, the response may contain headers and a body, both of which are
+
Besides status, the response may contain headers, cookies and a body, both of which are
specified the same way as in the request (see the previous paragraph).
8.5 Dynamic properties
The contract can contain some dynamic properties: timestamps, IDs, and so on. You do not
want to force the consumers to stub their clocks to always return the same value of time
so that it gets matched by the stub.
For Groovy DSL you can provide the dynamic parts in your contracts
diff --git a/1.2.x/single/spring-cloud-contract.html b/1.2.x/single/spring-cloud-contract.html
index 181e0c717c..5f479bf38d 100644
--- a/1.2.x/single/spring-cloud-contract.html
+++ b/1.2.x/single/spring-cloud-contract.html
@@ -3118,6 +3118,9 @@ the recommended way, as doing so makes the tests ho
headers:
foo: bar
fooReq: baz
+ cookies:
+ foo: bar
+ fooReq: baz
body:
foo: bar
matchers:
@@ -3149,7 +3152,12 @@ response:
- key: foo2
regex: bar
- key: foo3
- command: andMeToo($it)
request may contain additional request cookies, as shown in the following example:
Groovy DSL.
+
org.springframework.cloud.contract.spec.Contract.make {
+ request {
+ //...
+
+ // Each Cookies is added in form `'Cookie-Key' : 'Cookie-Value'`.
+ // there are also some helper methods
+ cookies {
+ cookie 'key': 'value'
+ cookie('another_key', 'another_value')
+ }
+
+ //...
+ }
+
+ response {
+ //...
+ }
+}
+
YAML.
+
request:
+...
+cookies:
+ foo: bar
+ fooReq: baz
request may contain a request body:
Groovy DSL.
org.springframework.cloud.contract.spec.Contract.make {
request {
@@ -3312,7 +3345,7 @@ following code shows an example:
Groovy DSL.
response:
...
status: 200
-
Besides status, the response may contain headers and a body, both of which are
+
Besides status, the response may contain headers, cookies and a body, both of which are
specified the same way as in the request (see the previous paragraph).
8.5 Dynamic properties
The contract can contain some dynamic properties: timestamps, IDs, and so on. You do not
want to force the consumers to stub their clocks to always return the same value of time
so that it gets matched by the stub.
For Groovy DSL you can provide the dynamic parts in your contracts
diff --git a/1.2.x/spring-cloud-contract-maven-plugin/checkstyle.html b/1.2.x/spring-cloud-contract-maven-plugin/checkstyle.html
index c8bf2746f0..5ef9ea32fe 100644
--- a/1.2.x/spring-cloud-contract-maven-plugin/checkstyle.html
+++ b/1.2.x/spring-cloud-contract-maven-plugin/checkstyle.html
@@ -1,13 +1,13 @@
Version: 1.2.5.BUILD-SNAPSHOT
diff --git a/1.2.x/spring-cloud-contract.xml b/1.2.x/spring-cloud-contract.xml
index f43e3d4f3a..523d012ac0 100644
--- a/1.2.x/spring-cloud-contract.xml
+++ b/1.2.x/spring-cloud-contract.xml
@@ -5355,6 +5355,9 @@ the recommended way, as doing so makes the tests host-in
headers:
foo: bar
fooReq: baz
+ cookies:
+ foo: bar
+ fooReq: baz
body:
foo: bar
matchers:
@@ -5386,7 +5389,12 @@ response:
- key: foo2
regex: bar
- key: foo3
- command: andMeToo($it)
+ command: andMeToo($it)
+ cookies:
+ - key: foo2
+ regex: bar
+ - key: foo3
+ predefined:
request may contain additional request headers, as shown in the following example:
@@ -5423,6 +5431,40 @@ headers:
fooReq: baz
+request may contain additional request cookies, as shown in the following example:
+
+Groovy DSL
+
+org.springframework.cloud.contract.spec.Contract.make {
+ request {
+ //...
+
+ // Each Cookies is added in form `'Cookie-Key' : 'Cookie-Value'`.
+ // there are also some helper methods
+ cookies {
+ cookie 'key': 'value'
+ cookie('another_key', 'another_value')
+ }
+
+ //...
+ }
+
+ response {
+ //...
+ }
+}
+
+
+
+YAML
+
+request:
+...
+cookies:
+ foo: bar
+ fooReq: baz
+
+request may contain a request body:Groovy DSL
@@ -5624,7 +5666,7 @@ following code shows an example:
status: 200
-Besides status, the response may contain headers and a body, both of which are
+Besides status, the response may contain headers, cookies and a body, both of which are
specified the same way as in the request (see the previous paragraph).