mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-01 19:10:12 +03:00
fix: Changes renderer on auth problems
This commit is contained in:
parent
1c3f796219
commit
f276c48d63
|
@ -31,3 +31,10 @@ class SchemaView(APIView):
|
||||||
if schema is None:
|
if schema is None:
|
||||||
raise exceptions.PermissionDenied()
|
raise exceptions.PermissionDenied()
|
||||||
return Response(schema)
|
return Response(schema)
|
||||||
|
|
||||||
|
def handle_exception(self, exc):
|
||||||
|
if isinstance(exc, (exceptions.NotAuthenticated,
|
||||||
|
exceptions.AuthenticationFailed)):
|
||||||
|
self.request.accepted_renderer = renderers.JSONRenderer()
|
||||||
|
|
||||||
|
return super(SchemaView, self).handle_exception(exc)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user