id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 32162,AsyncTestClient crashes on requests with JSON data.,Tom Miller,patrick,"POST requests that are created using the AsyncTestClient do not seem to have a valid 'Content-Length' header. In addition, attempting to print the body of a POST request raises an exception (seemingly related to the invalid 'Content-Length'). These issues can be demonstrated using AsyncRequestFactory: {{{ >>> from django.test import AsyncRequestFactory >>> rf = AsyncRequestFactory() >>> post_request = rf.post('/submit/', {'foo': 'bar'}) >>> print(post_request.headers) {'Host': 'testserver', 'Content-Length': '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'Content-Type': 'multipart/form-data; boundary=BoUnDaRyStRiNg', 'Cookie': ''} >>> print(post_request.body) ValueError Traceback (most recent call last) /opt/my_project/venv/lib64/python3.6/site-packages/django/http/request.py in body(self) 318 # Limit the maximum request data size that will be handled in-memory. 319 if (settings.DATA_UPLOAD_MAX_MEMORY_SIZE is not None and --> 320 int(self.META.get('CONTENT_LENGTH') or 0) > settings.DATA_UPLOAD_MAX_MEMORY_SIZE): 321 raise RequestDataTooBig('Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE.') 322 ValueError: invalid literal for int() with base 10: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0 }}} ",Bug,closed,Testing framework,3.1,Release blocker,fixed,"AsyncTestClient, AsyncRequestFactory",Andrew Godwin Carlton Gibson,Ready for checkin,1,0,0,0,0,0