Skip to content

assert: accept full HTTP success and redirect status classes - #1959

Open
jakezwang wants to merge 1 commit into
stretchr:masterfrom
jakezwang:fix-http-status-classes
Open

assert: accept full HTTP success and redirect status classes#1959
jakezwang wants to merge 1 commit into
stretchr:masterfrom
jakezwang:fix-http-status-classes

Conversation

@jakezwang

@jakezwang jakezwang commented Sep 8, 2026

Copy link
Copy Markdown

Summary

Fix HTTPSuccess and HTTPRedirect rejecting valid status codes such as 207 and 308.

Changes

  • Accept the full 2xx and 3xx status classes instead of stopping at 206 and 307.
  • Add handler-based regression tests for the omitted codes and class boundaries, checking the return value and reported test failure.

Motivation

A handler returning 207 Multi-Status, 208 Already Reported, or 226 IM Used currently fails HTTPSuccess; 308 Permanent Redirect fails HTTPRedirect. HTTP status classes are defined by the first digit (RFC 9110).

Validation: the new regression fails on the previous code and passes with this fix. go test -v -race -count=1 ./..., .ci.gogenerate.sh, .ci.gofmt.sh, and .ci.govet.sh pass with Go 1.26.4.

Related issues

None; reproduced against current master.

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