Fixed issue11082 - Reject str for POST data with a TypeError. Document the need to explicitly encode to bytes when using urlencode.

This commit is contained in:
Senthil Kumaran 2011-02-11 11:25:47 +00:00
parent 44028d8663
commit 2933312fe7
4 changed files with 23 additions and 9 deletions

View file

@ -1048,6 +1048,9 @@ class AbstractHTTPHandler(BaseHandler):
if request.data is not None: # POST
data = request.data
if isinstance(data, str):
raise TypeError("POST data should be bytes"
" or an iterable of bytes. It cannot be str.")
if not request.has_header('Content-type'):
request.add_unredirected_header(
'Content-type',