如何在Wiremock查询参数中传递数组
现在已经有几天了,我被Wiremock困住了。我不知道如何在GET方法中发送数组参数。 我想发送此如何在Wiremock查询参数中传递数组,wiremock,Wiremock,现在已经有几天了,我被Wiremock困住了。我不知道如何在GET方法中发送数组参数。 我想发送此GEThttp://localhost/test?filter[]=完整和令牌=任何。 所以我的json看起来是这样的 { "request": { "method": "GET", "urlPath": "/test?filter[]=full", "queryParameters": { "token": {
GEThttp://localhost/test?filter[]=完整和令牌=任何
。
所以我的json看起来是这样的
{
"request": {
"method": "GET",
"urlPath": "/test?filter[]=full",
"queryParameters": {
"token": {
"matches": "^[A-Za-z0-9-_=.]*$"
}
}
},
"response": {
"status": 200
}
}
但我有一个错误,这里是错误响应
| Closest stub | Request |
-----------------------------------------------------------------------------------------------------------------------
|
GET | GET
/test?filter[]=full | /test?filter[]=full&token=eyJhbGciOiJIUzI1NiIsInR5cCI6Ikp<<<<< URL does not match
| XVCJ9.eyJpYXQiOjE1MTYyMzkwMjJ9.tbDepxpstvGdW8TC3G8zg4B6rU
| YAOvfzdceoH48wgRQ
|
Query: token [matches] ^[A-Za-z0-9-_=.]*$ | token:
| eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkw
| MjJ9.tbDepxpstvGdW8TC3G8zg4B6rUYAOvfzdceoH48wgRQ
|
|
-----------------------------------------------------------------------------------------------------------------------
|最近存根|请求|
-----------------------------------------------------------------------------------------------------------------------
|
得到
/test?filter[]=full |/test?filter[]=full&token=eyJhbGciOiJIUzI1NiIsInR5cCI6Ikp问题在于您正在URL路径中放置查询参数:
“urlPath”:“/test?filter[]=full”
您需要做的是将filter[]
移动到查询参数块中:
{
"request": {
"method": "GET",
"urlPath": "/test",
"queryParameters": {
"token": {
"matches": "^[A-Za-z0-9-_=.]*$"
},
"filter%5B%5D": {
"equalTo": "full"
}
}
},
"response": {
"status": 200
}
}