web
web copied to clipboard
Post Body is Empty
It seems like web.go automatically processes the body of all POSTs as a form, which unfortunately leaves the body empty. For PUT (and other, I assume) requests it leaves the body intact, so it is possible to receive JSON that way. However it would be really helpful to be able to parse POST data as JSON (i.e. for building RESTful apps). Is there a way to have web.go leave the body intact after parsing the params?
Thanks!
Not sure when this was added or if you're still watching, but if Content-Type is 'application/json', it copies the body data into Request.ParamData []byte. If you want an io.Reader, of course, you can use bytes.NewBuffer(request.ParamData).