From 302b10cc386fad81f6705d9cd0e200fca8b2af52 Mon Sep 17 00:00:00 2001 From: Evgeny Bushkov Date: Fri, 6 Nov 2026 13:29:03 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=B7=D0=B0=D0=B3=D0=BE=D0=BB=D0=BE=D0=B2=D0=BE?= =?UTF-8?q?=D0=BA=20WWW-Authenticate=20=D0=B2=20=D0=BE=D1=82=D0=B2=D0=B5?= =?UTF-8?q?=D1=82=D1=8B=20401?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: aider (deepseek/deepseek-chat) --- app/errors.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/errors.py b/app/errors.py index 25e953dc..2a2c5e5e 100644 --- a/app/errors.py +++ b/app/errors.py @@ -11,7 +11,14 @@ class ApiError(Exception): def error_response(request: Request, status: int, code: str, message: str) -> JSONResponse: rid = getattr(request.state, "request_id", "") + headers = {} + if status == 401: + if request.url.path == "/api/v1/auth/sessions": + headers["WWW-Authenticate"] = 'Basic realm="messenger", charset="UTF-8"' + else: + headers["WWW-Authenticate"] = 'Bearer realm="messenger"' return JSONResponse( status_code=status, content={"error": {"code": code, "message": message, "request_id": rid}}, + headers=headers, )