Skip to content

--assert-status overwrites while --assert-header accumulates, undocumented #35

Description

@korya

Problem

Repeating an assertion flag behaves differently depending on the flag's type:

  • StringArray flags (--assert-header, --assert-header-eq, --assert-header-missing) accumulate — every occurrence becomes an assertion.
  • Scalar flags (--assert-status, --assert-body, --assert-body-eq, --assert-redirect, --assert-redirect-eq) overwrite — last one wins, silently.

Reproduction

$ http-assert --assert-status 500 --assert-status 200 http://127.0.0.1:8791/ok
[+] PASSED       ← only the 200 assertion ran; the 500 vanished

Why it matters

Silently discarding an assertion is the worst failure mode for a test tool — the run goes green having checked less than the user asked for.

Suggested fix

Document the distinction, and either warn when a scalar assertion flag is overwritten or promote the body/redirect assertions to StringArray so they accumulate like the header ones.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions