Skip to content

[Bug] Web API: ошибки auth/rate-limit всегда HTTP 400 вместо 401/429 #414

Description

@Ibochkarev

Описание проблемы

  1. CustomerProfileController / CustomerEmailController при отсутствии auth возвращают error без code → Router ставит HTTP 400.
  2. Closures login/register в web.php всегда мапят processor error в HttpStatus::BAD_REQUEST, в том числе rate-limit Login.

Клиенты не могут отличить bad credentials / unauthenticated / throttle; retry-логика на 401 ломается.

Шаги воспроизведения

  1. Без сессии: PUT /api/v1/customer/profile → HTTP 400, body success:false.
  2. 6+ неверных POST /api/v1/customer/login с одного IP → HTTP 400 (не 429/401).

Ожидаемое поведение

  • Unauthenticated → 401
  • Invalid credentials → 401 (или 400 с отдельным error code)
  • Rate limit → 429

Фактическое поведение

// web.php login/register
return Response::error($response->getMessage(), HttpStatus::BAD_REQUEST);

// Router normalize: $result['code'] ?? 400

Окружение

  • MiniShop3: beta / REST API
  • MODX: 3.x
  • PHP: 8.2+

Дополнительный контекст

Смежно с #341 (единый envelope), но это конкретный auth-status баг, не общая унификация.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority: mediumСредний приоритет

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions