mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-30 18:09:59 +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:
|
||||
raise exceptions.PermissionDenied()
|
||||
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