Skip to content

Asserting one of two expected status codes #4531

@lkurcak

Description

@lkurcak

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)$/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions