Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

body is null in LoggerWithFormatter #68

Open
dasuma opened this issue Feb 7, 2022 · 0 comments
Open

body is null in LoggerWithFormatter #68

dasuma opened this issue Feb 7, 2022 · 0 comments

Comments

@dasuma
Copy link

dasuma commented Feb 7, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant