I have not found any way so far.
https://docs.djangoproject.com/en/1.8/topics/testing/tools/#django.test.Client.options
shows that options allows request.body via get request but cannot find any way to pass via post request. Any ideas, I have been looking for a few hours now.
Yes:
self.client.generic('POST', '/url', 'raw post data')
If you really want to do:
request.body = b'{"first": "fred", "last": "dredd"}'
You should do it like this:
request._body = b'{"first": "fred", "last": "dredd"}'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With