3

Is there a way in Hoverly-Java APIs to custom match a JSON request body?

For instance, say I have this request body that my service will use

{
  "name": "Tom",
  "age": 24,
  "timestamp": <unix time stamp long>
}

I want to be able to skip the matching/checking for timestamp when building the stub but match other parts of the JSON body.

When I stub the relevant request for this body, none of the existing matcher types fit my need. It is not an exact match, not a partialJsonMatch etc.

Help appreciated.

Higher-Kinded Type
  • 1,964
  • 5
  • 27
  • 44

1 Answers1

0

You could match on any body or remove the timestamp from your json and use the PartialMatcher.
And then you could check the request afterwards by getting the journal from the hoverfly client. Each JournalEntry has a field with the request details.