Added regex escaping for request body matching
This commit is contained in:
@@ -23,7 +23,9 @@ class SpockMethodBodyBuilder {
|
||||
blockBuilder.addLine(".header('$it.key', '$it.value.equalTo')")
|
||||
}
|
||||
if (stubDefinition.request.bodyPatterns) {
|
||||
blockBuilder.addLine(".body('${JsonOutput.toJson(stubDefinition.request.bodyPatterns[0].matches)}')")
|
||||
String matches = stubDefinition.request.bodyPatterns[0].matches
|
||||
matches = matches.replaceAll('\\\\', '');
|
||||
blockBuilder.addLine(".body('${JsonOutput.toJson(matches)}')")
|
||||
}
|
||||
|
||||
blockBuilder.unindent().endBlock().addEmptyLine()
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
},
|
||||
"bodyPatterns": [
|
||||
{
|
||||
"matches": "{\"client\":{\"pesel\":\"1234567890\"},\"loanApplicationId\":123123123,\"amount\":123.123}"
|
||||
"matches": "\\{\"clientPesel\":\"1234567890\",\"loanAmount\":123.123\\}"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user