Merge branch '2.1.x'

This commit is contained in:
Marcin Grzejszczak
2019-07-08 15:39:40 +02:00
3 changed files with 11 additions and 3 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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(