Merge branch '2.1.x'
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.contract.verifier.converter
|
||||
|
||||
|
||||
import java.util.regex.Pattern
|
||||
|
||||
import groovy.transform.PackageScope
|
||||
@@ -138,7 +139,11 @@ class ContractsToYaml {
|
||||
request.urlPath = contract.request?.urlPath?.serverValue
|
||||
request.headers = (contract.request?.headers as Headers)?.asMap {
|
||||
String headerName, DslProperty prop ->
|
||||
MapConverter.getTestSideValues(prop).toString()
|
||||
def testSideValue = MapConverter.getTestSideValues(prop)
|
||||
if (testSideValue instanceof ExecutionProperty) {
|
||||
return MapConverter.getStubSideValuesForNonBody(prop).toString()
|
||||
}
|
||||
return testSideValue.toString()
|
||||
}
|
||||
request.cookies = (contract.request?.cookies as Cookies)?.asTestSideMap()
|
||||
Object body = contract.request?.body?.serverValue
|
||||
|
||||
@@ -25,7 +25,8 @@ import org.springframework.cloud.contract.spec.ContractConverter
|
||||
/**
|
||||
* Simple converter from and to a {@link YamlContract} to a collection of {@link Contract}
|
||||
*
|
||||
* @since 1.2.1* @author Marcin Grzejszczak
|
||||
* @since 1.2.1
|
||||
* @author Marcin Grzejszczak
|
||||
* @author Tim Ysewyn
|
||||
*/
|
||||
@Slf4j
|
||||
|
||||
@@ -364,6 +364,7 @@ class DslToYamlContractConverterSpec extends Specification {
|
||||
])
|
||||
headers { // (5)
|
||||
contentType('application/json')
|
||||
header(authorization(), $(c('Bearer SOMETOKEN'), p(execute('authToken()'))))
|
||||
}
|
||||
}
|
||||
response { // (6)
|
||||
@@ -387,7 +388,8 @@ class DslToYamlContractConverterSpec extends Specification {
|
||||
yamlContract.request.body["client.id"] =~ /[0-9]{10}/
|
||||
yamlContract.request.body["loanAmount"] == 99999
|
||||
yamlContract.request.headers == [
|
||||
"Content-Type": "application/json"
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": 'Bearer SOMETOKEN'
|
||||
]
|
||||
yamlContract.request.matchers.headers == [
|
||||
new YamlContract.KeyValueMatcher(
|
||||
|
||||
Reference in New Issue
Block a user