mirror of
https://github.com/django/django.git
synced 2025-11-17 02:24:22 +00:00
Improved unicode-type, ASCII-convertible header handling in
HttpResponse. Fixed #8765. Thanks to SmileyChris and semenov for working on this one. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13740 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
3444b065ba
commit
b2d2cb4a31
2 changed files with 16 additions and 7 deletions
|
|
@ -204,9 +204,18 @@ class HttpResponseTests(unittest.TestCase):
|
|||
r['value'] = u'test value'
|
||||
self.failUnless(isinstance(r['value'], str))
|
||||
|
||||
# An error is raised When a unicode object with non-ascii is assigned.
|
||||
# An error is raised ~hen a unicode object with non-ascii is assigned.
|
||||
self.assertRaises(UnicodeEncodeError, r.__setitem__, 'value', u't\xebst value')
|
||||
|
||||
# An error is raised when a unicode object with non-ASCII format is
|
||||
# passed as initial mimetype or content_type.
|
||||
self.assertRaises(UnicodeEncodeError, HttpResponse,
|
||||
mimetype=u't\xebst value')
|
||||
|
||||
# HttpResponse headers must be convertible to ASCII.
|
||||
self.assertRaises(UnicodeEncodeError, HttpResponse,
|
||||
content_type=u't\xebst value')
|
||||
|
||||
# The response also converts unicode keys to strings.)
|
||||
r[u'test'] = 'testing key'
|
||||
l = list(r.items())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue