I am writing automated tests in Django and started writing tests for an API endpoint that supports the put method. I am making my put request like so:
response = self.client.put(path, data=json.dumps({"key": "value"})
print(response.request)
As you see, I'm trying to see the details of the request that is being sent. I am particularly interested in seeing what goes into the body of the request. But the object returned by response.request is a dictionary that does not contain the "body" key or anything similar. I think this is a weird feature for the testing framework not to have, seeing as how it could come in handy in many different scenarios. Is there any way I can access the body of the request that I have not yet discovered? Or does the feature really not exist?
You can not get request body like:
because Django uses FakePayload