Closed christeredvartsen closed 4 years ago
I added a scenario now that requests an endpoint that responds with:
[
{
"integer": 123,
"string": "value"
}
]
and to target the string
value I used the following:
Then the response body contains JSON:
"""
{
"[0]": {
"string": "@myMatcher()"
}
}
"""
when I targeted the integer value to force an error the following error message is generated:
Want string yo
================================================================================
= Needle =======================================================================
================================================================================
"@myMatcher()"
================================================================================
= Haystack =====================================================================
================================================================================
123
The way to target numerically indexed arrays might be somewhat weird, but it should be thoroughly documented here: https://behat-api-extension.readthedocs.io/en/latest/guide/verify-server-response.html#match-specific-keys-in-a-numerically-indexed-array-key-index
Yes you got it :-) Thank you for your time.
No worries.
Add example from https://github.com/imbo/behat-api-extension/issues/86 to verify custom matcher behavior.