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
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
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
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:
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
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
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
7 matches
Mail list logo