-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsmoke-test.sh
More file actions
89 lines (73 loc) · 2.65 KB
/
Copy pathsmoke-test.sh
File metadata and controls
89 lines (73 loc) · 2.65 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env bash
set -e
cd "$(dirname "$0")"
MDF_WALLET=0xDeAdBeEf1234 MDF_PORT=3000 MDF_DASHBOARD_PORT=3001 bun src/index.ts &
SERVER_PID=$!
# Poll until ready
for i in $(seq 1 30); do
curl -s --max-time 1 http://localhost:3000/mdf.json > /dev/null 2>&1 && break
sleep 0.2
done
echo ""
echo "=== /mdf.json ==="
curl -s http://localhost:3000/mdf.json | python3 -m json.tool
echo ""
echo "=== /llms.txt ==="
curl -s http://localhost:3000/llms.txt
echo ""
echo "=== / browser ==="
curl -s -o /dev/null -w "status:%{http_code} type:%{content_type}\n" -H "Accept: text/html" http://localhost:3000/
echo ""
echo "=== / agent (markdown) ==="
curl -s -H "Accept: text/markdown" http://localhost:3000/ | head -5
echo ""
echo "=== /docs/getting-started response headers ==="
curl -s -D - -o /dev/null -H "Accept: text/markdown" http://localhost:3000/docs/getting-started \
| grep -E "^HTTP|Content-Type|X-MDF|ETag"
echo ""
echo "=== /premium/deep-dive — no payment ==="
curl -s http://localhost:3000/premium/deep-dive
echo ""
echo "=== /premium/deep-dive — stub payment ==="
curl -s -w "\nstatus:%{http_code}" \
-H 'X-Payment: {"chain":"base","currency":"USDC","amount":"1.0000","txHash":"0xabc","from":"0xuser"}' \
-H "Accept: text/markdown" \
http://localhost:3000/premium/deep-dive | head -8
echo ""
echo "=== /private/internals — no token, no payment ==="
curl -s http://localhost:3000/private/internals
echo ""
echo "=== POST /mdf/auth — issue bearer token ==="
TOKEN_RESP=$(curl -s -X POST http://localhost:3000/mdf/auth \
-H "Content-Type: application/json" \
-d '{"path":"/private/internals","txHash":"0xdeadbeef","from":"0xwallet"}')
echo "$TOKEN_RESP"
TOKEN=$(echo "$TOKEN_RESP" | python3 -c "import sys,json; print(json.load(sys.stdin)['token'])")
echo ""
echo "=== /private/internals — with bearer token ==="
curl -s -D - -o /dev/null \
-H "Accept: text/markdown" \
-H "Authorization: Bearer $TOKEN" \
http://localhost:3000/private/internals \
| grep -E "^HTTP|Content-Type|X-MDF"
echo ""
echo "=== 304 conditional GET ==="
ETAG=$(curl -s -D - -o /dev/null -H "Accept: text/markdown" \
http://localhost:3000/docs/getting-started \
| grep -i etag | tr -d '\r' | awk '{print $2}')
echo "ETag: $ETAG"
curl -s -o /dev/null -w "status:%{http_code}\n" \
-H "Accept: text/markdown" \
-H "If-None-Match: $ETAG" \
http://localhost:3000/docs/getting-started
echo ""
echo "=== dashboard /health ==="
curl -s http://localhost:3001/health
echo ""
echo "=== 404 ==="
curl -s -o /dev/null -w "status:%{http_code}\n" http://localhost:3000/does-not-exist
echo ""
echo "=== server log (last 10 lines) ==="
kill $SERVER_PID
wait $SERVER_PID 2>/dev/null
echo "done"