Included JSON matching for body
Feature request: Include JSON patch matching for request body in the withBody() matcher. Like https://github.com/spotify/java-hamcrest#json-matchers
I guess you mean JSON path :)
HttpClientMock in current version works fine with json-matchers
HttpClientMock mock = new HttpClientMock();
mock.onGet("/aaa").withBody(isJsonStringMatching(
jsonObject().where("foo", is(jsonInt(1)))
)
);
Do you need something more?
Yes, it works perfectly fine. My point was to include it inside library to make it more smooth :)
I've added a PR adding dependency to hamcrest-jackson.
However, the more I think about this "improvement", the less appealing whole idea seems to me...
Hi @jarst
Thanks for contributing to HttpClientMock.
I've looked at your PR. I agree that adding dependency is not a big improvement.
TBH I rather thought about adding a method like:
withBodyHavingJsonField('foo.bar', equal('some test'))
Before you start implementation please reach me and consult the proposition.