Open garak opened 2 years ago
Could you provide an example where this piece of code breaks because of this assumption?
For example, when the JSON string passed is "OK"
Do you have a feature file that I can try out so I can see the example with some context?
Not at the moment. Anyway, you can simply have an endpoint returning "OK"
and assertion that the JSON response is that string
For values other than arrays you could simply use Then the response body is: <PyStringNode>
instead though:
That would prevent me from validating that the content is a proper JSON string
You could probably do that quite easy with a custom check.
I don't personally see the benefit of fixing the existing code for this, but if you want to provide a PR I would most likely merge it.
jsonDecode method assumes that every value decoded from a JSON string is an array. This is a wrong assumption since the value can also be a string, a boolean, or null. See also PHP Manual