Changes between Initial Version and Version 1 of Ticket #23773


Ignore:
Timestamp:
Nov 6, 2014, 5:17:25 AM (10 years ago)
Author:
Baptiste Mispelon
Comment:

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.
     1If 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
    23
    3     def post(self, path, data=None, content_type=MULTIPART_CONTENT, secure=False, **extra):
    4         "Construct a POST request."
     4def post(self, path, data=None, content_type=MULTIPART_CONTENT, secure=False, **extra):
     5    "Construct a POST request."
    56
    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}}}
    710
    811Here 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.
Back to Top