We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 428c220 commit 58e7667Copy full SHA for 58e7667
ninja_extra/operation.py
@@ -20,6 +20,7 @@
20
from django.http.response import HttpResponse, HttpResponseBase
21
from django.utils.encoding import force_str
22
from ninja.constants import NOT_SET
23
+from ninja.errors import AuthenticationError
24
from ninja.operation import (
25
AsyncOperation as NinjaAsyncOperation,
26
)
@@ -245,7 +246,8 @@ async def _run_authentication(self, request: HttpRequest) -> Optional[HttpRespon
245
246
if result:
247
request.auth = result # type: ignore
248
return None
- return self.api.create_response(request, {"detail": "Unauthorized"}, status=401)
249
+
250
+ return self.api.on_exception(request, AuthenticationError())
251
252
@asynccontextmanager
253
async def _prep_run( # type:ignore
0 commit comments