So, my post request looks something like this:
fetch('/endpoint', {method: "POST", body: "my string"})
And, I'm trying to bind the body to a string like this:
var x string
c.Bind(&x)
But I'm getting the error reflect: NumField of non-struct type.
What is the appropriate way to get the body as a string, or do I need to just use the http Request.Body as a reader?
Was able to accomplish my goal with 3 lines:
buf := new(bytes.Buffer)
buf.ReadFrom(c.Request.Body)
str := buf.String()
where str is the string containing the post body
Most helpful comment
Was able to accomplish my goal with 3 lines:
where str is the string containing the post body