mirror of
https://github.com/gin-gonic/gin.git
synced 2026-06-13 00:59:29 +08:00
Merge a05bd4a07aa83c1575356ab672b0c605ac8823f4 into d7776de7d444935ea4385999711bd6331a98fecb
This commit is contained in:
commit
f5c0bc8f0c
@ -1056,9 +1056,10 @@ func (c *Context) requestHeader(key string) string {
|
||||
/************************************/
|
||||
|
||||
// bodyAllowedForStatus is a copy of http.bodyAllowedForStatus non-exported function.
|
||||
// Use http.StatusContinue constant for better code clarity
|
||||
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
|
||||
|
||||
@ -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))
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user