Re: Can not read request.body from a POST request

2016-04-23 Thread Vijay Khemlani
Yeah, I was wrong, I actually use request.body in my code without problem with the default middlewares enabled. On Sat, Apr 23, 2016 at 11:00 AM, Daniel Roseman wrote: > On Wednesday, 20 April 2016 21:29:09 UTC+1, Mihai Corciu wrote: >> >> Is there a method to access

Re: Can not read request.body from a POST request

2016-04-23 Thread Daniel Roseman
On Wednesday, 20 April 2016 21:29:09 UTC+1, Mihai Corciu wrote: > > Is there a method to access request.body from a POST request in Django, > without disabling 'django.middleware.csrf.CsrfViewMiddleware' ? > > CsrfViewMiddleware is causing: > > Exception Type: RawPostDataException > Exception

Re: Can not read request.body from a POST request

2016-04-21 Thread Gergely Polonkai
A JSON/XML payload, for example. If you use plain Django (on DRF and other extensions), then request.body is the only way to access said payload. Best, Gergely Gergely Polonkai [image: https://]about.me/gergely.polonkai

Re: Can not read request.body from a POST request

2016-04-21 Thread Vijay Khemlani
What could be in the body that's not in the supplied Django fields? I have implemented RESTful APIs as you say (no idea why that matters as they are just HTTP requests) and never had the need to read the actual body.. On Thu, Apr 21, 2016 at 2:13 AM, Gergely Polonkai wrote:

Re: Can not read request.body from a POST request

2016-04-20 Thread Gergely Polonkai
Vijay: They are not the same thing. request.POST, .GET and .FILES are exactly that, POST and GET data and the optional uploaded files. However, in e.g. a RESTful environment it is possible to have something else in the request body. Mihai, what else do you do with the request before trying to

Re: Can not read request.body from a POST request

2016-04-20 Thread Vijay Khemlani
Why would you want to access request.body directly? You should use request.POST, request.GET, request.FILES. On Wed, Apr 20, 2016 at 5:27 PM, Mihai Corciu wrote: > Is there a method to access request.body from a POST request in Django, > without disabling

Can not read request.body from a POST request

2016-04-20 Thread Mihai Corciu
Is there a method to access request.body from a POST request in Django, without disabling 'django.middleware.csrf.CsrfViewMiddleware' ? CsrfViewMiddleware is causing: Exception Type: RawPostDataException Exception Value: You cannot access body after reading from request's data stream