mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-16 03:02:37 +03:00
fix(response): remove http content-type header on status code 204_NO_CONTENT
This commit is contained in:
parent
73cbb9cd4a
commit
3538cafd56
|
@ -9,6 +9,7 @@ from http.client import responses
|
|||
from django.template.response import SimpleTemplateResponse
|
||||
|
||||
from rest_framework.serializers import Serializer
|
||||
from rest_framework.status import HTTP_204_NO_CONTENT
|
||||
|
||||
|
||||
class Response(SimpleTemplateResponse):
|
||||
|
@ -79,7 +80,7 @@ class Response(SimpleTemplateResponse):
|
|||
)
|
||||
return ret.encode(charset)
|
||||
|
||||
if not ret:
|
||||
if not ret or self.status_code == HTTP_204_NO_CONTENT:
|
||||
del self['Content-Type']
|
||||
|
||||
return ret
|
||||
|
|
Loading…
Reference in New Issue
Block a user