Hello :wave: Can we put a condition on the respo...
# help
d
Hello 👋 Can we put a condition on the response's bodyFileName field in JSON mapping way. e.g. if my list(here the state features list) size >2 , return resp1 else resp2. A quick hand will help a lot :D
l
Not to my knowledge
🆗 1
d
not sure whether this works for you, but an alternative approach can be to use a matcher and define two stub mappings using `listSizeMoreThan`:
Copy code
{
  "request": {
    "method": "GET",
    "urlPattern": "/test/[^/]+",
    "customMatcher": {
      "name": "state-matcher",
      "parameters": {
        "hasContext": "{{request.pathSegments.[1]}}",
        "listSizeMoreThan": "2"
      }
    }
  },
  "response": {
    "status": 200,
    "bodyFileName": "moreThanTwo.json"
  }
}
another approach can be to implement this with handlebars - you can access the extension there, but I'm can't give you the exact syntax on this one.
d
1st approach, I already included to make it work. Handle bars, I pre assumed that, was not sure. That I can give a try definitely. Thanks anyway :D
👍 1