Asserting one of two expected status codes
Problem to solve
Accepting multiple status codes.
Useful for repeatable scripts where we DELETE resources at the beginning and leave them at the end. We need to accept both 200 and 404 for the DELETE request.
Proposals
Extend the HTTP syntax
HTTP 200,404
Very straighforward and easy to understand.
Add the or keyword
[Asserts]
status == 200 or status == 404
Allows full logical expressivity (essentially CNF).
Add the in predicate
[Asserts]
status in [200, 404]
More explicit than regex, works for integer types.
Workaround
It's possible to achieve this behavior using existing tools but is human and AI unfriendly:
HTTP *
[Asserts]
status toString matches /^(200|404)$/
Hi @lkurcak
Yes we need to take some times to settle a syntax for this (see also #2600 #872 #2212)
I'd be in favor of adding all three! I understand this requires consensus and some deliberation though.