This commit is contained in:
2026-10-20 21:31:57 +03:00
parent 41bdfcfea2
commit bb600e9dd1
4 changed files with 95 additions and 1 deletions
+6
View File
@@ -17,6 +17,7 @@ from app.db import check_database_ready, engine, get_db
from app.deps import basic_scheme, pagination_params, require_user
from app.errors import (
ApiError,
InvalidRequest,
Unavailable,
api_error_handler,
common_headers,
@@ -217,6 +218,11 @@ async def login(
db: AsyncSession = Depends(get_db),
_basic: None = Security(basic_scheme),
):
# Contract: login takes only "Authorization: Basic", no request body.
# Any body (malformed JSON, "{}", ...) is rejected before the password check.
if await request.body():
raise InvalidRequest("POST /auth/sessions does not accept a request body.")
return await create_user_session(
db,
request.headers.get("Authorization"),
+2 -1
View File
@@ -61,7 +61,8 @@ class User(ApiModel):
class CreateChat(ApiModel):
# Contract: 1-100 code points (lab2 allowed 255 by mistake).
title: str = Field(min_length=1, max_length=100)
member_ids: list[UUID] = Field(min_length=1)
# Contract: 1-100 members (minItems/maxItems in openapi.json).
member_ids: list[UUID] = Field(min_length=1, max_length=100)
@field_validator("title")
@classmethod