mirror of
https://github.com/3ybactuk/marketplace-go-service-project.git
synced 2025-10-30 14:03:45 +03:00
87 lines
1.9 KiB
HTTP
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 {} 204 No Content; 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
|