Files
3ybactuk-marketplace-go-ser…/docs/homework-1/cart.http
Dmitry Kopylov 3d3f10647b [HW-1] added docs
2025-05-17 15:06:08 +03:00

87 lines
1.9 KiB
HTTP

### 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