1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #30550 -- Fixed decoding of non-UTF-8 bytes objects in response.json().

This commit is contained in:
Jon Dufresne
2019-06-06 21:40:15 -07:00
committed by Mariusz Felisiak
parent 498092377b
commit d6ea4898c4
4 changed files with 11 additions and 1 deletions

View File

@@ -109,6 +109,10 @@ def return_json_response(request):
return JsonResponse({'key': 'value'}, **kwargs)
def return_json_response_latin1(request):
return HttpResponse(b'{"a":"\xc5"}', content_type='application/json; charset=latin1')
def return_text_file(request):
"A view that parses and returns text as a file."
match = CONTENT_TYPE_RE.match(request.META['CONTENT_TYPE'])