Go gin get request body json

If you only want to pass the request body JSON to Redis as a value, then you do not need to bind the JSON to a value. Read the raw JSON from the request body directly and just pass it through:

jsonData, err := ioutil.ReadAll(c.Request.Body)
if err != nil {
    // Handle error
}
err = client.Set("id", jsonData, 0).Err()

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)