Extended sample groovy dsl with placeholders
This commit is contained in:
@@ -44,6 +44,8 @@ class SpockMethodBodyBuilder {
|
||||
blockBuilder.addLine("response.header('$it.key') == '$it.value'")
|
||||
}
|
||||
if (stubDefinition.response.body) {
|
||||
blockBuilder.endBlock()
|
||||
blockBuilder.addLine('and:').startBlock()
|
||||
blockBuilder.addLine('def responseBody = new JsonSlurper().parseText(response.body.asString())')
|
||||
stubDefinition.response.body.serverValue.each {
|
||||
def value = it.value
|
||||
|
||||
@@ -6,7 +6,8 @@ io.coderate.accurest.dsl.GroovyDsl.make {
|
||||
}
|
||||
body("""\
|
||||
{
|
||||
"name": "Jan"
|
||||
"name": "Jan",
|
||||
"id": "${value(client('abc'), server('def'))}",
|
||||
}
|
||||
"""
|
||||
)
|
||||
@@ -16,10 +17,12 @@ io.coderate.accurest.dsl.GroovyDsl.make {
|
||||
status 200
|
||||
body("""\
|
||||
{
|
||||
"name": "Jan"
|
||||
"name": "Jan",
|
||||
"id": "${value(client('123'), server('321'))}",
|
||||
"surname": "${value(client('Kowalsky'), server('$checkIfSurnameValid($value)'))}"
|
||||
}
|
||||
"""
|
||||
)
|
||||
)
|
||||
headers {
|
||||
header 'Content-Type': 'text/plain'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user