Skip to content

test: cover HTTP 300 redirect assertion - #1997

Open
renanmpimentel wants to merge 1 commit into
stretchr:masterfrom
renanmpimentel:test/http-redirect-multiple-choices
Open

renanmpimentel wants to merge 1 commit into
stretchr:masterfrom
renanmpimentel:test/http-redirect-multiple-choices

Conversation

@renanmpimentel

@renanmpimentel renanmpimentel commented Oct 22, 2026 •

Copy link
Copy Markdown

Summary

Add a regression test that HTTPRedirect accepts HTTP 300 Multiple Choices, the lower boundary of the 3xx status range.

Changes

  • Exercise the status through an HTTP handler and verify both the boolean result and the assertion reporter.
  • Keep the permanent diff limited to assert/http_assertions_test.go.

Motivation

A one-character boundary change could make HTTPRedirect reject HTTP 300 while all previous tests remain green. This test protects the first status in the redirect range, including the boolean result and reported assertion.

The existing redirect tests check 307 as accepted and 101, 200, and 500 as rejected. In an isolated worktree, changing the lower-bound comparison from >= 300 to > 300 leaves the entire unchanged suite green. The new test fails by assertion under that regression and passes with the current production code. This is test coverage only; it does not change behavior or fix a production bug.

Verification

  • go test ./... — passed (Go 1.25 container)
  • go vet ./... — passed
  • gofmt -l assert/http_assertions_test.go — clean
  • git diff --check — passed

Supertest audit method

I used the Supertest test-audit skill to probe whether the existing suite would catch a plausible violation of this contract. The regression was applied only in an isolated worktree. The regression proof records three executed states: the existing tests pass with that regression, the new assertion fails against the same regression, and the new test passes with the original production code restored. The published diff adds tests only.

Related issues

None linked; this test protects existing behavior.

Repository guidance

The description follows .github/pull_request_template.md and includes the motivation and change type requested by CONTRIBUTING.md. This is test coverage for existing behavior; no production behavior changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant