default bodyFileName when file name does not match

246 views
Skip to first unread message

Anurag Raghuvanshi

unread,
Jul 21, 2022, 12:28:01 AM7/21/22
to wiremock-user
Hi Team,

I have set up a wiremock standalone server and used response templating to get filename from {{ request.query }} but i want to throw a default JSON file as a response if the file does not exist .

{
    "priority" : 1,
    "request": {
    "urlPathPattern": "/search/items",
    "method": "GET",
    "queryParameters": {
          "id": {
                "contains": "doc"
           },
      }
     },
    "response" : {
     "status" : 200,
     "bodyFileName" : "response-{{jsonPath request.query '$.id'}}.json",      
     "headers": {
           "Content-Type": "application/json"
       }
     }


Any help on the above thread, about how to make another mapping handle this when no file found or how to give default filename !? 

Thanks :)

Reply all
Reply to author
Forward
0 new messages