examples
examples copied to clipboard
body is null in LoggerWithFormatter
i have a problems when i try loggin del body because de body is null
gin.LoggerWithFormatter(func(param gin.LogFormatterParams) string {
body, err := ioutil.ReadAll(param.Request.Body)
the problem is in my controller i have this code
var body entities.WriteChatRequest
if err := c.ShouldBindJSON(&body); err != nil {
c.JSON(400, gin.H{"error": err.Error()})
return
}
the body was converted but now is null, when the controller finished and i try logging