Files
ai_english/serve/scripts/test_log_format.bat
2025-11-17 13:39:05 +08:00

40 lines
1.0 KiB
Batchfile

@echo off
echo.
echo Testing Backend Log Format
echo ================================
echo.
set BASE_URL=http://localhost:8080
echo [1/5] Testing Health Check (GET 200)
curl -s "%BASE_URL%/health" >nul 2>&1
timeout /t 1 /nobreak >nul
echo [2/5] Testing Login (POST 200)
curl -s -X POST "%BASE_URL%/api/v1/auth/login" -H "Content-Type: application/json" -d "{\"account\":\"test@example.com\",\"password\":\"Test@123\"}" >nul 2>&1
timeout /t 1 /nobreak >nul
echo [3/5] Testing 404 Error (GET 404)
curl -s "%BASE_URL%/api/v1/not-found" >nul 2>&1
timeout /t 1 /nobreak >nul
echo [4/5] Testing OPTIONS Preflight (OPTIONS 204)
curl -s -X OPTIONS "%BASE_URL%/api/v1/user/profile" -H "Origin: http://localhost:3001" >nul 2>&1
timeout /t 1 /nobreak >nul
echo [5/5] Testing Unauthorized (GET 401)
curl -s "%BASE_URL%/api/v1/user/profile" >nul 2>&1
timeout /t 1 /nobreak >nul
echo.
echo Test Complete!
echo.
echo View logs:
echo type logs\app.log
echo.
echo View last 20 lines:
echo powershell "Get-Content logs\app.log -Tail 20"
echo.
pause