pook icon indicating copy to clipboard operation
pook copied to clipboard

JSON subset matching

Open sarayourfriend opened this issue 8 months ago • 0 comments

It would be nice to be able to match request body JSON using an expected subset of the data. Something like:

(pook.post(url)
    .json({"id": identifier}, subset=True)
    .reply(200))

As a way to match a larger request body that's:

{
  "id": ...,
  "created_on": ...,
  "updated_on": ...,
  "other_property_irrelevant_to_the_test": ...,
}

Right now the only way to do this is using a regex pattern with the body matcher, but that's pretty tedious, especially if you have multiple subset properties you want to test.

sarayourfriend avatar Jun 21 '24 00:06 sarayourfriend