Overriding APIView.get_renderers()
does not automatically set Vary: Accept
header
#8735
Unanswered
PoByBolek
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
One of my view classes overrides
APIView.get_renderers()
to return different renderers based on the inidividual view action, e.g.list()
may use different renderers thanretrieve()
orupdate()
. But it doesn't set therenderer_classes
class attribute (because it doesn't need to anymore). Sincerenderer_classes
still has its default value (and only contains a single value in my case), DRF doesn't set theVary: Accept
header for that view:django-rest-framework/rest_framework/views.py
Lines 153 to 160 in 2510456
Did I mess up here? Is
APIView.get_renderers()
considered a private API and am I supposed to only setrenderer_classes
? I mean,get_renderers()
is at least mentioned on your documentation page... And there appear to be a few others who do this.If not, would it be possible to add the
Vary: Accept
based on the result ofget_renderers()
instead ofrenderer_classes
?Beta Was this translation helpful? Give feedback.
All reactions