Skip to content
Myr

refactor: replace magic numbers with named constants in bodyAllowedForStatus (#4529)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Use http.StatusContinue and http.StatusOK instead of hardcoded 100 and 199 for the 1xx informational status range check, consistent with the pattern already used in logger.go. Fixes #4489

authored by Varun Chawla · committed by GitHub · parent 8e07d37 · Browse files · 1 file+1 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−1 removed

  • other:+1 added−1 removed

1 file+1 added−1 removed

modified:context.go+1 added-1 removed
1056 unmodified lines
10571058// bodyAllowedForStatus is a copy of http.bodyAllowedForStatus non-exported function.1059func bodyAllowedForStatus(status int) bool {1060 switch {1061 case status >= 100 && status <= 199:1061 case status >= http.StatusContinue && status < http.StatusOK:1062 return false1063 case status == http.StatusNoContent:1064 return false1065 case status == http.StatusNotModified:
417 unmodified lines