[HW-1] added docs

This commit is contained in:
Dmitry Kopylov
2025-05-17 15:06:08 +03:00
parent b61fcb1465
commit 3d3f10647b
12 changed files with 455 additions and 0 deletions

86
docs/homework-1/cart.http Normal file
View File

@@ -0,0 +1,86 @@
### add 1 sku to cart
POST http://localhost:8080/user/31337/cart/1076963
Content-Type: application/json
{
"count": 1
}
### expected {} 200 OK; must add 1 item
### add 5 sku to cart
POST http://localhost:8080/user/31337/cart/1076963
Content-Type: application/json
{
"count": 5
}
### expected {} 200 OK; must add 5 more item, 1076963 - must be 6 items
### add unknown sku to cart
POST http://localhost:8080/user/31337/cart/1076963000
Content-Type: application/json
{
"count": 1
}
### expected {} 412 Precondition Failed; invalid sku
### add another sku to cart
POST http://localhost:8080/user/31337/cart/1148162
Content-Type: application/json
{
"count": 1
}
### expected {} 200 OK; must add 1 item
### invalid user
POST http://localhost:8080/user/0/cart/1148162
Content-Type: application/json
{
"count": 1
}
### expected {} 400 Bad Request
### invalid sku
POST http://localhost:8080/user/31337/cart/0
Content-Type: application/json
{
"count": 1
}
### expected {} 400 Bad Request
### invalid count
POST http://localhost:8080/user/31337/cart/1148162
Content-Type: application/json
{
"count": 0
}
### expected {} 400 Bad Request
# ========================================================================================
### delete whole sku from cart
DELETE http://localhost:8080/user/31337/cart/1076963
Content-Type: application/json
### expected {} 200 OK; must delete item from cart
### delete whole cart
DELETE http://localhost:8080/user/31337/cart
Content-Type: application/json
### expected {} 204 No Content; must delete cart
# ========================================================================================
### get list of a cart
GET http://localhost:8080/user/31337/cart
Content-Type: application/json
### expected {} 200 OK; must show cart
### get invalid list of cart
GET http://localhost:8080/user/0/cart
Content-Type: application/json
### 400 bad request