-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreq.sh
More file actions
executable file
·37 lines (28 loc) · 764 Bytes
/
req.sh
File metadata and controls
executable file
·37 lines (28 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
API_URL="http://localhost:8080"
echo "Sending 10 email-only requests..."
for i in {1..10}; do
curl -s -X POST "$API_URL/new-user" \
-H "Content-Type: application/json" \
-d "{
\"email\": \"user$i@example.com\"
}" > /dev/null
echo "Email request $i sent"
done
echo
echo "Sending 10 order requests..."
for i in {1..10}; do
ORDER_ID="ORD-$(date +%s)-$i"
curl -s -X POST "$API_URL/orders" \
-H "Content-Type: application/json" \
-d "{
\"order_id\": \"$ORDER_ID\",
\"customer_id\": \"CUST-$i\",
\"email\": \"customer$i@example.com\",
\"amount\": $((100 + i * 10)),
\"items\": [\"item1\", \"item2\"]
}" > /dev/null
echo "Order request $i sent ($ORDER_ID)"
done
echo
echo "Done."