Skip to content

--assert-body-empty=false and --assert-ok=false behave inconsistently #32

Description

@korya

Problem

parseAssertionFlags handles boolean assertion flags two different ways:

  • --assert-ok uses cmd.Flags().Changed(...), so --assert-ok=false registers an assert-NOT-ok (AssertStatusNOK).
  • --assert-body-empty uses the value directly (if v, _ := ...GetBool(...); v), so --assert-body-empty=false registers nothing.

Reproduction

$ http-assert --assert-ok=false http://127.0.0.1:8791/500
[:] HTTP/1.1 500 Internal Server Error
[+] PASSED
[exit=0]

$ http-assert --assert-body-empty=false http://127.0.0.1:8791/ok
Error: Cannot perform request: no assertions defined

Why it matters

Two flags of the same shape do different things. Neither behaviour is documented.

Suggested fix

Make them consistent, and document the negation. The --assert-ok=false behaviour is genuinely useful — consider promoting it to a first-class --assert-not-ok flag, and adding --assert-body-not-empty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions