| | #!/bin/bash |
| |
|
| | |
| | set -e |
| |
|
| | echo "Testing proxy-url Docker container..." |
| |
|
| | |
| | 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 |
| |
|
| | |
| | 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 |
| |
|
| | |
| | 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 |
| |
|
| | |
| | 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 |
| |
|
| | |
| | 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." |
| |
|