Dirk Bolte
03/20/2025, 11:28 AMJohnny Condon
03/20/2025, 11:32 AMDirk Bolte
03/20/2025, 11:33 AMJohnny Condon
03/20/2025, 11:35 AMJohnny Condon
03/21/2025, 7:45 AM"urlPathPattern": "/api/v1/resource/[^\\/]+",
the id I was trying to access was at the regex part of the uri path but I had "contains": "{{request.pathSegments.[1]}}"
which was returning the api
once I updated it to "{{request.pathSegments.[3]}}"
everything worked exactly as expected.
I had one last question, I'm trying to mock off an external system where the body of the request is text. The text contains an ID that I have stored in state from a previous request, is there any matcher that can be used in state-matcher
that would look at the entire request body and if it contained the id in state then it would successfully match.
Something like:
"customMatcher": {
"name": "state-matcher",
"parameters": {
"hasContext": "id-to-request-body-matcher",
"property": {
"idToFind": {
"contains": "{{request.body}}"
}
}
}
}
Ideally if it worked something like bodyPatterns that would be great:
"request" : {
"url" : "/api/example/endpoint",
"method" : "POST",
"bodyPatterns": [
{
"contains": "{{state context='id-to-request-body-matcher' property='idToFind' default=''}}"
}
]
},
but for the state-matcher
. I'm not sure the handlebars notation for accessing state is handled inside the request
above.Dirk Bolte
03/21/2025, 8:29 PM