Reputation: 2811
I was trying to pass path parameter using Mountebank.
Below is working, but there path is static no any parameters.
"predicates": [
{
"equals": {
"method": "GET",
"path": "/accounts",
"query": {
"permissionId": "xxx"
}
}
}
],
"responses": [
{
..... }
]
In case if I need to do GET /accounts/[account-no]
where account-no
is a parameter
Upvotes: 0
Views: 1519
Reputation: 407
Why don't you specify the path param explicitly like:
"path": `${someBasePath}/${path.param}/${somethingElse}`
It'd work if you knew its value. Otherwise, your predicates will be as simple as this:
[{"matches": {"method": "GET", "path": "\/accounts\/.*"}}]
TY
Upvotes: 0
Reputation: 2811
Below regex worked, Please note use matches
in case of regex instead of equal
"predicates": [
{
"matches": {
"method": "GET",
"path": "/accounts/\\d+",
"query": {
"permissionId": "xxx"
}
}
}
],
"responses": [
{
..... }
]
Upvotes: 1