mon*_*nty 5 http-request-parameters wiremock wiremock-standalone
我正在尝试使用以下存根点击 WireMock,但查询参数似乎没有匹配。这是回应:
Request was not matched
=======================
-----------------------------------------------------------------------------------------------------------------------
| Closest stub | Request |
-----------------------------------------------------------------------------------------------------------------------
|
GET | GET
/mpp-pricing/v1/agreements\?accountId=.* | /mpp-pricing/v1/agreements?accountId=5388afaf-ee3d-44ed-a<<<<< URL does not match. When using a regex, "?" should be "\\?"
| b2a-0035156bb0a2
|
Run Code Online (Sandbox Code Playgroud)
这是我使用的存根:
{
"request": {
"method": "GET",
"urlPathPattern": "/mpp-pricing/v1/agreements\\?accountId=.*"
},
Run Code Online (Sandbox Code Playgroud)
我自己也遇到过同样的问题,但我能够通过使用 queryParameters 重写匹配器来克服。
也许您可以做类似的事情并重写您的模式,如下所示:
{
"request": {
"method": "GET",
"urlPathPattern": "/mpp-pricing/v1/agreements",
"queryParameters": {
"accountId": {
"matches": ".*"
}
}
}
},
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13921 次 |
| 最近记录: |