Когда использовать
Design HTTP APIs with explicit input and response contracts.
Решения для реализации
- Define methods, content type, bounds and response shapes first.
- Separate malformed JSON from structurally invalid data.
- Use stable error codes and do not return stack traces.
- Allow CORS only for intended origins; wildcard is suitable for public read APIs without credentials.
Как проверить результат
- Oversized and malformed requests fail predictably.
- Client prices are ignored.
- Error envelopes match documentation.
Работающий пример
POST
/api/quoteНажмите «Отправить», чтобы получить ответ сервера.
Сервер считает сумму по своему каталогу. Заказ и платёж не создаются.