Dhruvraj Mishra
06/14/2025, 11:57 AMDhruvraj Mishra
06/14/2025, 12:02 PM{
"request": {
"method": "POST",
"urlPathPattern": "/wiremock/status"
},
"response": {
"status": 200,
"bodyFileName": "home/statusAccepted.json",
"headers": {
"Content-Type": "application/json; charset=utf-8"
}
},
"serveEventListeners": [
{
"name": "recordState",
"parameters": {
"context": "IdList",
"list": {
"addLast": {
"id": "{{jsonPath request.body '$.id[0]'}}"
}
}
}
}
]
}
{
"request": {
"method": "GET",
"urlPathPattern": "/wiremock/status2",
"customMatcher": {
"name": "state-matcher",
"parameters": {
"hasContext": "IdList",
"listSizeMoreThan": "0"
}
}
},
"response": {
"status": 200,
"bodyFileName": "home/status2resp.json",
"headers": {
"Content-Type": "application/json; charset=utf-8"
}
}
}
status2resp.json-
{
"pagination": {
"pageSize": 1000,
"totalPages": 1,
"pageNumber": 1,
"totalRecords": 1
},
"data": [
{{# each (state context='IdList' property='id' default='[]') }}
{
"id": "{{id}}"
}{{#unless @last}},{{/unless}}
{{/each}}
]
}
I'm getting resp as-
{
"pagination": {
"pageSize": 1000,
"totalPages": 1,
"pageNumber": 1,
"totalRecords": 1
},
"data": [
{
"id": ""
},
{
"id": ""
},
{
"id": ""
},
{
"id": ""
},
{
"id": ""
},
{
"id": ""
},
{
"id": ""
},
{
"id": ""
},
{
"id": ""
},
{
"id": ""
},
{
"id": ""
},
{
"id": ""
},
{
"id": ""
},
{
"id": ""
},
{
"id": ""
},
{
"id": ""
},
{
"id": ""
},
{
"id": ""
},
{
"id": ""
},
{
"id": ""
},
{
"id": ""
},
{
"id": ""
},
{
"id": ""
}
]
}Dhruvraj Mishra
06/14/2025, 12:04 PMDhruvraj Mishra
06/14/2025, 12:06 PM{{# each (state context='IdList' property='list' default='[]') }}
for anyone if it help 🙂Dirk Bolte
06/14/2025, 12:08 PM