Problem
AssertStatusOK (assertions.go:12) treats 200–399 as OK:
if s := res.StatusCode; s < 200 || s >= 400 {
But the flag help says Assert response is successful (2xx) and the README table says Assert 2xx status code.
Reproduction
$ http-assert --assert-ok http://127.0.0.1:8791/redirect # responds 302 Found
[.] HTTP/1.1 GET http://127.0.0.1:8791/redirect
[:] HTTP/1.1 302 Found
[+] PASSED
[exit=0]
This is a docs bug, not a logic bug
assertions_test.go (Test_AssertStatusOK) explicitly pins 300, 301, 307 and 399 as OK, so the 2xx–3xx range is intentional (curl -f semantics). Only the documentation is wrong.
Why it matters
Combined with redirects not being followed, a health check pointed at an endpoint that starts 302-ing to a login page passes green.
Suggested fix
- Update the flag description to something like
Assert response is not an error (2xx or 3xx).
- Update the README assertion table.
- Consider a separate
--assert-2xx for people who want the strict reading.
Problem
AssertStatusOK(assertions.go:12) treats 200–399 as OK:But the flag help says
Assert response is successful (2xx)and the README table saysAssert 2xx status code.Reproduction
This is a docs bug, not a logic bug
assertions_test.go(Test_AssertStatusOK) explicitly pins300,301,307and399as OK, so the 2xx–3xx range is intentional (curl-fsemantics). Only the documentation is wrong.Why it matters
Combined with redirects not being followed, a health check pointed at an endpoint that starts 302-ing to a login page passes green.
Suggested fix
Assert response is not an error (2xx or 3xx).--assert-2xxfor people who want the strict reading.