mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-16 19:41:06 +03:00
Only add 'Vary: Accept' header when there is more than one possible renderer.
This commit is contained in:
parent
9f0ead9597
commit
18f26ff5cc
|
@ -112,11 +112,13 @@ class APIView(View):
|
|||
|
||||
@property
|
||||
def default_response_headers(self):
|
||||
# TODO: Only vary by accept if multiple renderers
|
||||
return {
|
||||
headers = {
|
||||
'Allow': ', '.join(self.allowed_methods),
|
||||
'Vary': 'Accept'
|
||||
}
|
||||
if len(self.renderer_classes) > 1:
|
||||
headers['Vary'] = 'Accept'
|
||||
return headers
|
||||
|
||||
|
||||
def http_method_not_allowed(self, request, *args, **kwargs):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user