#!/bin/bash # Exit on error set -e echo "Testing proxy-url Docker container..." # Check if the container is running if ! docker ps | grep -q proxy-url; then echo "Starting proxy-url container..." docker run -d --name proxy-url-test -p 8001:8001 proxy-url:latest echo "Waiting for container to start..." sleep 5 fi # Test basic functionality echo "Testing basic proxy functionality..." curl -s http://localhost:8001/https://httpbin.org/get | grep -q "url" if [ $? -eq 0 ]; then echo "✅ Basic GET request successful" else echo "❌ Basic GET request failed" exit 1 fi # Test with query parameters echo "Testing with query parameters..." curl -s "http://localhost:8001/https://httpbin.org/get?param1=value1" | grep -q "param1" if [ $? -eq 0 ]; then echo "✅ Query parameters test successful" else echo "❌ Query parameters test failed" exit 1 fi # Test POST request echo "Testing POST request..." curl -s -X POST -H "Content-Type: application/json" -d '{"test":"data"}' http://localhost:8001/https://httpbin.org/post | grep -q "test" if [ $? -eq 0 ]; then echo "✅ POST request test successful" else echo "❌ POST request test failed" exit 1 fi # Clean up echo "Cleaning up test container..." docker stop proxy-url-test docker rm proxy-url-test echo "All tests passed! The Docker container is working correctly."