36 lines
957 B
Bash
Executable File
36 lines
957 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Test session persistence with a single curl session
|
|
echo "Testing session persistence with single curl session..."
|
|
|
|
# Using session with -c and -b to maintain cookies across requests
|
|
COOKIE_JAR="./test_cookies.txt"
|
|
|
|
echo "=== Step 1: Login ==="
|
|
curl -c "$COOKIE_JAR" -b "$COOKIE_JAR" \
|
|
-X POST \
|
|
-H "Content-Type: application/x-www-form-urlencoded" \
|
|
-d "username=admin&password=admin123" \
|
|
-v \
|
|
http://localhost:5003/login
|
|
|
|
echo -e "\n=== Step 2: Set Active Project ==="
|
|
curl -c "$COOKIE_JAR" -b "$COOKIE_JAR" \
|
|
-X POST \
|
|
-H "Content-Type: application/json" \
|
|
-v \
|
|
http://localhost:5003/api/projects/1/set-active
|
|
|
|
echo -e "\n=== Step 3: Execute Script ==="
|
|
curl -c "$COOKIE_JAR" -b "$COOKIE_JAR" \
|
|
-X POST \
|
|
-H "Content-Type: application/json" \
|
|
-d '{}' \
|
|
-v \
|
|
http://localhost:5003/api/scripts/7/execute
|
|
|
|
echo -e "\n=== Cookies file content ==="
|
|
cat "$COOKIE_JAR"
|
|
|
|
echo -e "\n=== Cleanup ==="
|
|
rm -f "$COOKIE_JAR" |