Description
when i call ctx.JSON()
returned a response with 500,and i want print log status code,but get the value is 200
How to reproduce
fmt.Println("*****0 **** status: ", status)
ctx.JSON(status, map[string]interface{}{
"code": code,
"msg": msg,
"data": data,
})
fmt.Println("*** 1 *** status: ", status)
fmt.Println("response code: ******** ", ctx.Writer.Status())
Expectations
*****0 **** status: 500
*** 1 *** status: 500
response code: ******** 500
Actual result
*****0 **** status: 500
*** 1 *** status: 500
response code: ******** 200
Environment
- go version: go version go1.17.1 darwin/arm64
- gin version (or commit ref): github.com/gin-gonic/gin v1.7.7
- operating system: Mac
Comment From: x-lambda
Comment From: x-lambda
it should be my program caused