Fixed #27156 -- Made changing HttpRequest.encoding clear GET.
This commit is contained in:
parent
b28c6ca763
commit
371adc472a
|
@ -226,8 +226,8 @@ class HttpRequest(object):
|
||||||
next access (so that it is decoded correctly).
|
next access (so that it is decoded correctly).
|
||||||
"""
|
"""
|
||||||
self._encoding = val
|
self._encoding = val
|
||||||
if hasattr(self, '_get'):
|
if hasattr(self, 'GET'):
|
||||||
del self._get
|
del self.GET
|
||||||
if hasattr(self, '_post'):
|
if hasattr(self, '_post'):
|
||||||
del self._post
|
del self._post
|
||||||
|
|
||||||
|
|
|
@ -562,6 +562,16 @@ class RequestsTests(SimpleTestCase):
|
||||||
request.encoding = 'iso-8859-16'
|
request.encoding = 'iso-8859-16'
|
||||||
self.assertEqual(request.POST, {'name': ['Hello GĂŒnter']})
|
self.assertEqual(request.POST, {'name': ['Hello GĂŒnter']})
|
||||||
|
|
||||||
|
def test_set_encoding_clears_GET(self):
|
||||||
|
request = WSGIRequest({
|
||||||
|
'REQUEST_METHOD': 'GET',
|
||||||
|
'wsgi.input': '',
|
||||||
|
'QUERY_STRING': b'name=Hello%20G%C3%BCnter' if six.PY2 else 'name=Hello%20G%C3%BCnter'
|
||||||
|
})
|
||||||
|
self.assertEqual(request.GET, {'name': ['Hello Günter']})
|
||||||
|
request.encoding = 'iso-8859-16'
|
||||||
|
self.assertEqual(request.GET, {'name': ['Hello G\u0102\u0152nter']})
|
||||||
|
|
||||||
def test_FILES_connection_error(self):
|
def test_FILES_connection_error(self):
|
||||||
"""
|
"""
|
||||||
If wsgi.input.read() raises an exception while trying to read() the
|
If wsgi.input.read() raises an exception while trying to read() the
|
||||||
|
|
Loading…
Reference in New Issue