Skip to content

body is null in LoggerWithFormatter #68

@dasuma

Description

@dasuma

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions