mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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:
parent
44028d8663
commit
2933312fe7
4 changed files with 23 additions and 9 deletions
|
@ -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',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue