我有一个 ./mappings/*.json 文件中描述的存根。
"request": {
"method": "POST",
"url": "/some/thing",
"bodyPatterns" : [ {
"matchesXPath" : {
"expression": "//nodeA/text()",
"contains": "999"
}
} ]
}
Wiremock (ver.2.26.2) 以独立模式启动。当我这样调用服务时:
curl -d "<request><nodeA>999</nodeA></request>" -X POST http://localhost:8888/some/thing
我按预期从存根收到响应。问题是必须使用 XML 声明标记发送请求,例如
curl -d "<?xml version="1.0" encoding="UTF-8"?><request><nodeA>999</nodeA></request>" -X POST http://localhost:8888/some/thing
在这种情况下,请求不匹配。我试图在有关它的文档中找到 smth,但到目前为止还没有运气