Compare commits

...

3 Commits

Author SHA1 Message Date
mehrdadbn9
7f912436d9
Merge 597ca7b6079407a2bf77f8e504b0046450fd1bb1 into d7776de7d444935ea4385999711bd6331a98fecb 2026-02-06 11:18:53 +00:00
mehrdadbn9
597ca7b607 Set codecov project coverage to informational for this PR 2026-02-06 14:48:47 +03:30
mehrdadbn9
7534258241 Use http.StatusContinue constant instead of magic number 100
Replace magic number `100` with `http.StatusContinue` constant for better code clarity and maintainability in `bodyAllowedForStatus` function.

Fixes #4489
2026-02-06 14:20:04 +03:30
3 changed files with 3 additions and 1 deletions

View File

@ -6,6 +6,7 @@ coverage:
default:
target: 99%
threshold: 99%
informational: true
patch:
default:

View File

@ -1058,7 +1058,7 @@ func (c *Context) requestHeader(key string) string {
// bodyAllowedForStatus is a copy of http.bodyAllowedForStatus non-exported function.
func bodyAllowedForStatus(status int) bool {
switch {
case status >= 100 && status <= 199:
case status >= http.StatusContinue && status <= 199:
return false
case status == http.StatusNoContent:
return false

View File

@ -1033,6 +1033,7 @@ func TestContextGetCookie(t *testing.T) {
func TestContextBodyAllowedForStatus(t *testing.T) {
assert.False(t, bodyAllowedForStatus(http.StatusProcessing))
assert.False(t, bodyAllowedForStatus(http.StatusNoContent))
assert.False(t, bodyAllowedForStatus(http.StatusContinue))
assert.False(t, bodyAllowedForStatus(http.StatusNotModified))
assert.True(t, bodyAllowedForStatus(http.StatusInternalServerError))
}