From 7534258241ccce82a1186a31395a3a8cc58c89c2 Mon Sep 17 00:00:00 2001 From: mehrdadbn9 Date: Fri, 6 Feb 2026 14:20:04 +0330 Subject: [PATCH] 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 --- context.go | 2 +- context_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/context.go b/context.go index d73f59e3..65affc7f 100644 --- a/context.go +++ b/context.go @@ -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 diff --git a/context_test.go b/context_test.go index 41694585..408b45bc 100644 --- a/context_test.go +++ b/context_test.go @@ -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)) }