mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #30550 -- Fixed decoding of non-UTF-8 bytes objects in response.json().
This commit is contained in:
committed by
Mariusz Felisiak
parent
498092377b
commit
d6ea4898c4
@@ -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'])
|
||||
|
||||
Reference in New Issue
Block a user