This message was deleted.
# general
s
This message was deleted.
1
a
What version of WireMock are you using? With your example, I was able to successfully retrieve file A or file B depending on
cuId
value.
👀 1
And you’re positive that the
matchesJsonPath
part is working, and you aren’t matching a separate mapping?
d
wiremock-jre3-standalone
2.35.0
Yes, I actually removed all other mapping files to ensure that that wasn't the case - there is only one mapping file in my directory at this point
a
Hmm… And you’ve restarted WireMock since making those changes?
d
Yep 😕
a
Any chance you can give the full mapping and a complete example request body? Might be something going on there
d
Copy code
{
  "name": "installment_mapping",
  "request": {
    "method": "POST",
    "url": "/lender",
    "headers": {
      "Content-Type": {
        "equalTo": "application/json"
      }
    },
    "bodyPatterns": [
      {
        "matchesJsonPath": "[?($.lender-type== 'installment')]"
      }
    ]
  },
  "response": {
    "status": 200,
    "headers": {
      "Content-Type": "application/json"
    },
    "bodyFileName": "{{#eq (jsonPath request.body '$.cuId') '1234'}}response_file_A.json{{else}}response_file_B.json{{/eq}}"
  }
}
Was actually about to ask if the full mapping file might help 😂 The request body is
Copy code
<http://localhost:8080/partner-service/lender>
{
    "firstName": "Danman",
    "lastName": "Mandan",
    "lender-type": "installment",
    "cuId": 1234
}
...actually think I just discovered that changing
cuId
from int to string in the request payload triggers the correct response 🤦
Yeah, I've got it figured out now - was improperly parsing for a string instead of an int in the handlebar
a
haha nice! glad you were able to get it sorted 😄
d
Same 🙂 - thank you for being my rubber duck 😂