+
import org.springframework.cloud.contract.spec.Contract
+
+Contract.make {
+ request {
+ method 'POST'
+ url 'http://localhost:8080/foo'
+ body('''
+ {"foo": 23 }
+ ''')
+ headers {
+ header('''Accept''', '''application/json''')
+ header('''Content-Type''', '''application/json''')
+ header('''Host''', '''localhost:8080''')
+ header('''Content-Length''', '''12''')
+ }
+ }
+ response {
+ status 200
+ body('''
+ bar
+ ''')
+ headers {
+ header('''Content-Type''', '''application/json;charset=UTF-8''')
+ header('''Content-Length''', '''3''')
+ }
+ testMatchers {
+ jsonPath('$[?(@.foo >= 20)]', byType())
+ }
+ }
+}
+