Hey guys is it possible to match a stub with curre...
# help
t
Hey guys is it possible to match a stub with current date? For example I have { "request": { "method": "POST", "url": "/xyz/xyz", "bodyPatterns": [ { "matchesJsonPath": CURRENT DATE (also current date - 1 year or + 1 year) }] } Would matching the current date be possible in this case?
t
Hi @Tarun Bhalla, yes you can do this using the the date matchers e.g.
Copy code
{
  "matchesJsonPath": {
    "expression": "$.completedDate",
    "after": "now +1 years",
    "truncateExpected": "first hour of day"
  }
}
t
Perfect thanks Tom!
👍 1
Hey Tom just one more question with this, so hypothetically if i was to be matching to more that 1 value so... "matchesJsonPath": "$[?(@.abc == '123' && @.xyz == '456' && currentDate == '$.completedDate'. )]" would something like that be feasible or what I have to create separate matchesJsonPath blocks to filter my request?
t
You’d need separate blocks or the logical AND matcher
t
Would you have any examples of a block that might do something similar to this? Just for me to reference off of - just new to wiremock and trying to play around with values