Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post Body is Empty #59

Open
paulbellamy opened this issue Mar 17, 2011 · 1 comment
Open

Post Body is Empty #59

paulbellamy opened this issue Mar 17, 2011 · 1 comment

Comments

@paulbellamy
Copy link

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!

@awpr
Copy link

awpr commented Dec 18, 2011

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants