45 lines
1.4 KiB
Bash
Executable file
45 lines
1.4 KiB
Bash
Executable file
#!/bin/bash
|
|
# Test the /process endpoint with a minimal 1x1 PNG image
|
|
|
|
# Create a minimal 1x1 white PNG (base64 encoded)
|
|
# This is the smallest valid PNG: 1x1 white pixel
|
|
TEST_IMAGE="iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg=="
|
|
|
|
echo "Testing /process endpoint with operations: optimize, convert-webp"
|
|
echo "================================================================"
|
|
|
|
curl -s -X POST http://localhost:8004/process \
|
|
-H "Content-Type: application/json" \
|
|
-d "{
|
|
\"image\": \"$TEST_IMAGE\",
|
|
\"mimeType\": \"image/png\",
|
|
\"operations\": [\"optimize\", \"convert-webp\"],
|
|
\"family\": \"square\"
|
|
}" | jq '{
|
|
success,
|
|
processed: (.processed | {width, height, format, fileSize}),
|
|
derivatives: (.derivatives | keys),
|
|
metadata
|
|
}'
|
|
|
|
echo ""
|
|
echo "Testing with derivatives operation"
|
|
echo "=================================="
|
|
|
|
curl -s -X POST http://localhost:8004/process \
|
|
-H "Content-Type: application/json" \
|
|
-d "{
|
|
\"image\": \"$TEST_IMAGE\",
|
|
\"mimeType\": \"image/png\",
|
|
\"operations\": [\"optimize\", \"convert-webp\", \"derivatives\"],
|
|
\"family\": \"hero\"
|
|
}" | jq '{
|
|
success,
|
|
processed: (.processed | {width, height, format, fileSize}),
|
|
derivatives: (.derivatives | keys),
|
|
metadata: {
|
|
operationsApplied: .metadata.operationsApplied,
|
|
processingTimeMs: .metadata.processingTimeMs,
|
|
totalSize: .metadata.totalSize
|
|
}
|
|
}'
|