I'm using gin for creating web services.
gin has Bind(&request) which validates the request based on the tags provided in struct.
If the validation fails, it returns an error.
But I want the invalid request to be logged. How do I get the request json?
type SignupRequest struct {
FirstName string `json:"first_name" binding:"required"`
AssociatedBank string `json:"associated_bank" binding:"required"`
}
...
srj := NewSignupRequest()
err = c.Bind(srj)
If the required fails, I won't have the request data to log.