|
12 | 12 | def is_local_server_running(): |
13 | 13 | """Check if local TerminusDB server is running at http://127.0.0.1:6363""" |
14 | 14 | try: |
15 | | - response = requests.get("http://127.0.0.1:6363", timeout=2) |
16 | | - # Server responds with 200 (success) or 404 (not found but server is up) |
17 | | - # 401 (unauthorized) also indicates server is running but needs auth |
18 | | - return response.status_code in [200, 404] |
| 15 | + response = requests.get( |
| 16 | + "http://127.0.0.1:6363", timeout=2, allow_redirects=False |
| 17 | + ) |
| 18 | + # Any HTTP response means the server is running |
| 19 | + return response.status_code in [200, 302, 401, 404] |
19 | 20 | except (requests.exceptions.ConnectionError, requests.exceptions.Timeout): |
20 | 21 | return False |
21 | 22 |
|
22 | 23 |
|
23 | 24 | def is_docker_server_running(): |
24 | 25 | """Check if Docker TerminusDB server is already running at http://127.0.0.1:6366""" |
25 | 26 | try: |
26 | | - response = requests.get("http://127.0.0.1:6366", timeout=2) |
27 | | - # Server responds with 404 for root path, which means it's running |
28 | | - return response.status_code in [200, 404] |
| 27 | + response = requests.get( |
| 28 | + "http://127.0.0.1:6366", timeout=2, allow_redirects=False |
| 29 | + ) |
| 30 | + # Any HTTP response means the server is running |
| 31 | + return response.status_code in [200, 302, 401, 404] |
29 | 32 | except (requests.exceptions.ConnectionError, requests.exceptions.Timeout): |
30 | 33 | return False |
31 | 34 |
|
32 | 35 |
|
33 | 36 | def is_jwt_server_running(): |
34 | 37 | """Check if JWT Docker TerminusDB server is already running at http://127.0.0.1:6367""" |
35 | 38 | try: |
36 | | - response = requests.get("http://127.0.0.1:6367", timeout=2) |
37 | | - # Server responds with 404 for root path, which means it's running |
38 | | - return response.status_code in [200, 404] |
| 39 | + response = requests.get( |
| 40 | + "http://127.0.0.1:6367", timeout=2, allow_redirects=False |
| 41 | + ) |
| 42 | + # Any HTTP response means the server is running |
| 43 | + return response.status_code in [200, 302, 401, 404] |
39 | 44 | except (requests.exceptions.ConnectionError, requests.exceptions.Timeout): |
40 | 45 | return False |
41 | 46 |
|
|
0 commit comments