fix: Changes renderer on auth problems

This commit is contained in:
Giancarlo Rocha 2018-10-24 18:31:37 -03:00
parent 1c3f796219
commit f276c48d63

View File

@ -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)