Sergio GarciaAvila
08/01/2024, 2:41 PMLee Turner
08/01/2024, 3:13 PMequalTo
) can be used with handlebars expressions. You might need to take a look at equalToDateTime
where you can do the now
+ offset without the need for handlebars expressions.
Something like this maybe:
"bodyPatterns" : [ {
"matchesXPath" : {
"expression" : "//PickUp/Date/text()",
"equalToDateTime" : "now +7 days",
"actualFormat": "yyyy-MM-dd"
}
} ]
More information about the dates and time can be found here - https://wiremock.org/docs/request-matching/#dates-and-timesSergio GarciaAvila
08/01/2024, 3:19 PMSergio GarciaAvila
08/01/2024, 3:21 PMSergio GarciaAvila
08/01/2024, 3:21 PMSergio GarciaAvila
08/01/2024, 3:23 PMLee Turner
08/01/2024, 3:46 PMnow
returns a date/time so you are effectively comparing an incoming date 2024-08-08T00:00:00Z
with a value where the time portion is populate with the time when now
was executed. Try to truncate the expected:
"bodyPatterns": [{
"matchesXPath" : {
"expression": "//PickUp/Date/text()",
"equalToDateTime" : "now +7 days",
"actualFormat" : "yyyy-MM-dd",
"truncateExpected": "first hour of day"
}
}]
Sergio GarciaAvila
08/01/2024, 4:24 PMSergio GarciaAvila
08/01/2024, 4:25 PMLee Turner
08/01/2024, 4:29 PM