I am migrating an old project that uses Spring-Cloud-Contract v3.0.2.
Among others we have a contract with empty body:
request {
method 'POST'
url '/x'
body([:])
headers {
contentType(applicationJson())
}
}
with contracts v3.0.2 it generates:
"request" : {
"url" : "/x",
"method" : "POST",
"headers" : {
"Content-Type" : {
"matches" : "application/json.*"
}
},
"bodyPatterns" : [ {
"equalToJson" : "{}",
"ignoreArrayOrder" : false,
"ignoreExtraElements" : false
} ]
},
However, with anything newer (I've checked most versions from 3.0.3, through 3.1.8 and up to 4.0.4), this section is gone.
"request" : {
"url" : "/x",
"method" : "POST",
"headers" : {
"Content-Type" : {
"matches" : "application/json.*"
}
}
},
"response" : { // cut
I've read through release notes of Spring Cloud 2020.0 (which introduced Contracts v3.0.3) and couldn't find anything that would discuss that change.
Is such contract (for empty body case) now obsolete? How should I rewrite this to work with either v3.1.8 or v4.0.4 of Spring Cloud Contracts.
Thanks!
I've achieved very similar output with: