Changes between Initial Version and Version 1 of Ticket #23773
- Timestamp:
- Nov 6, 2014, 5:17:25 AM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #23773 – Description
initial v1 1 If you want to access request.body in a handler function to get the raw posted data and the value posted was the empty string "" with a content type of text/plain then what appears in request.body is a string representing an empty dictionary {} due to this line in client.py in the RequestFactory class. 1 If you want to access request.body in a handler function to get the raw posted data and the value posted was the empty string `""` with a content type of text/plain then what appears in request.body is a string representing an empty dictionary `{}` due to this line in client.py in the RequestFactory class. 2 {{{#!python 2 3 3 4 4 def post(self, path, data=None, content_type=MULTIPART_CONTENT, secure=False, **extra): 5 "Construct a POST request." 5 6 6 post_data = self._encode_data(data or {}, content_type) # <-- Problem line 7 post_data = self._encode_data(data or {}, content_type) # <-- Problem line 8 9 }}} 7 10 8 11 Here data is replaced with a dictionary before being passed to encoding but what I would expect to end up in request.body is the original empty string for a text/plain request.