43👍
According to django 1.6 deprecation timeline:
The attribute
HttpRequest.raw_post_data
was renamed to
HttpRequest.body
in 1.4. The backward compatibility will be removed –
HttpRequest.raw_post_data
will no longer work.
The motivation is described in the relevant ticket:
request.raw_post_dat
a is a bad name. It has nothing to do withPOST
in
particular, it’s just the body of the HTTP request. This confuses
users, and makes it look like Django doesn’t understand how HTTP
works. We should change the name torequest.body
and start a
deprecation process.
Use request.body
:
def api(request):
return HttpResponse("%s %s" % (request.method, request.body))
Hope that helps.
Source:stackexchange.com