我正在尝试使用 WireMock 创建动态模拟。我的网址是这样的:
http://localhost:8080/manage/classids/query1=ns1/query2=id1
然后我想输出为
{
"yourId":"id1"
}
我试着这样做
{
"name": "Req_GET",
"request": {
"urlPathPattern": "/manage/classids/query1=([a-zA-Z0-9]*)/query2=([a-zA-Z0-9]*)",
"method": "GET"
},
"response": {
"status": 200,
"jsonBody": {
"yourId": "{{request.path.[3]}}"
},
"transformers": [
"response-template"
],
"headers": {
"Content-Type": "application/json"
}
}
}
但我无法在“=”之后拆分响应,它在“/”之后是完整的
{
"yourId":"query2=id1"
}