mirror of
https://github.com/gin-gonic/gin.git
synced 2026-06-04 01:38:12 +08:00
fix: check error return value in test
This commit is contained in:
parent
d3bec39bd7
commit
e755eb8ce6
@ -1057,7 +1057,6 @@ func (c *Context) requestHeader(key string) string {
|
|||||||
|
|
||||||
// bodyAllowedForStatus is a copy of http.bodyAllowedForStatus non-exported function.
|
// bodyAllowedForStatus is a copy of http.bodyAllowedForStatus non-exported function.
|
||||||
// Uses http.StatusContinue constant for better code clarity.
|
// Uses http.StatusContinue constant for better code clarity.
|
||||||
// Upper bound 199 covers all 1xx informational status codes.
|
|
||||||
func bodyAllowedForStatus(status int) bool {
|
func bodyAllowedForStatus(status int) bool {
|
||||||
switch {
|
switch {
|
||||||
case status >= http.StatusContinue && status < http.StatusOK:
|
case status >= http.StatusContinue && status < http.StatusOK:
|
||||||
|
|||||||
@ -1090,7 +1090,7 @@ func TestServeErrorWritten(t *testing.T) {
|
|||||||
router := New()
|
router := New()
|
||||||
router.Use(func(c *Context) {
|
router.Use(func(c *Context) {
|
||||||
c.Writer.WriteHeader(http.StatusNotFound)
|
c.Writer.WriteHeader(http.StatusNotFound)
|
||||||
c.Writer.Write([]byte("custom error"))
|
_, _ = c.Writer.Write([]byte("custom error"))
|
||||||
c.Next()
|
c.Next()
|
||||||
})
|
})
|
||||||
router.NoRoute(func(c *Context) {
|
router.NoRoute(func(c *Context) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user