0

The sample JSON I use for stub

 {
  "request": {
    ...
    "bodyPatterns" : [ {
      "equalToJson" : "{ \"id\": abc123  }",
      "ignoreArrayOrder" : true,
      "ignoreExtraElements" : true
    } ]
    ...
  },

here the id is a dynamic value, so in this case, how can I do the request matching in wire mock

Cork Kochi
  • 1,783
  • 6
  • 29
  • 45

1 Answers1

3

You can use a wildcard to match any value of id:

"bodyPatterns" : [ {
      "equalToJson" : "{ \"id\": \"${json-unit.any-string}\"  }",
      "ignoreArrayOrder" : true,
      "ignoreExtraElements" : true
    } ]
Tom
  • 3,471
  • 21
  • 14