Echo frameworks context bind twice without losing data

07/07/2018

i trying to write a custom middleware, and i want to make sure the record’s ID truly existed, i have to get the record’s id from requests body data.

and i found a problem, Context.Bind only can bind once, after the request passed the middleware, you got error is: code=400, message=EOF.

actually, Context.Bind() function read request body data from the socket buffer, once you took it out, it just gone

solution

Golang: Read from an io.ReadWriter without losing its content