Monorepo for Aesthetic.Computer
aesthetic.computer
1#!/bin/bash
2#
3# Test the keep-mint endpoint with a real piece
4#
5# Usage: ./test-keep-endpoint.sh <piece-name>
6#
7
8if [ -z "$1" ]; then
9 echo "Usage: $0 <piece-name>"
10 echo "Example: $0 test-piece-123"
11 exit 1
12fi
13
14PIECE=$1
15ENDPOINT="http://localhost:8888/api/keep-mint"
16
17echo "╔══════════════════════════════════════════════════════════════╗"
18echo "║ 🧪 Testing Keep-Mint Endpoint ║"
19echo "╚══════════════════════════════════════════════════════════════╝"
20echo ""
21echo "📍 Piece: $PIECE"
22echo "🌐 Endpoint: $ENDPOINT"
23echo "🔧 Mode: mint (server-side)"
24echo ""
25
26# Make request
27echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
28echo "📤 Sending request..."
29echo ""
30
31curl -N -X POST "$ENDPOINT" \
32 -H "Content-Type: application/json" \
33 -H "Authorization: Bearer test-token" \
34 -d "{\"piece\": \"$PIECE\", \"mode\": \"mint\"}" \
35 2>&1 | while IFS= read -r line; do
36 # Parse SSE events
37 if [[ "$line" =~ ^data:\ (.*)$ ]]; then
38 DATA="${BASH_REMATCH[1]}"
39
40 # Pretty print JSON if jq is available
41 if command -v jq &> /dev/null; then
42 echo "$DATA" | jq -C '.'
43 else
44 echo "$DATA"
45 fi
46 echo ""
47 fi
48done
49
50echo ""
51echo "✅ Test complete"