Hi,
I have lots of bodyPattern mapping in my wiremock. Now one of my pattern is subset of other pattern; In this case stubbing used is the one for which mapping is created later
In below Example, stubbing 1 condition is subset of stubbing 2. Now, It becomes critical for me to create the mappings in correct order, otherwise stubbing will not work as desired. Is there any better solution for this?
If I create stubbing1 and then stubbing2 then it works as expected. Otherwise not.
This also restricts me to add these mappings directly to mapping folder. It picks in random order while reading from mapping folder
stubbing 1
{
"request": {
"url": "/url/goes/here/",
"method": "POST",
"bodyPatterns": [
{
"contains": "condition1"
},
{
"contains": "condition3"
}
]
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"bodyFileName": "Response1.json"
}
}
Stubbing 2
{
"request": {
"url": "/url/goes/here/",
"method": "POST",
"bodyPatterns": [
{
"contains": "condition1"
},
{
"contains": "condition2"
},
{
"contains": "condition3"
}
]
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"bodyFileName": "Response2.json"
}
}