From 27c1417473b1e711a6a2faa9b8d9922b5027f134 Mon Sep 17 00:00:00 2001 From: Masen Furer Date: Thu, 7 Nov 2024 20:43:57 -0800 Subject: [PATCH] integration: frontend port and backend port should return the same content with proxying enabled by default in dev mode, both frontend and backend ports on / should return the same content. --- scripts/wait_for_listening_port.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/wait_for_listening_port.py b/scripts/wait_for_listening_port.py index 247ff4fbaa..0417fd2681 100644 --- a/scripts/wait_for_listening_port.py +++ b/scripts/wait_for_listening_port.py @@ -10,6 +10,8 @@ from concurrent.futures import ThreadPoolExecutor, as_completed from typing import Tuple +import httpx + # psutil is already a dependency of Reflex itself - so it's OK to use import psutil @@ -61,6 +63,12 @@ def main(): else: print(f"FAIL: {msg}") exit(1) + # Make sure the HTTP response for both ports is the same (proxy frontend to backend). + responses = [(port, httpx.get(f"http://localhost:{port}")) for port in args.port] + n_port, n_resp = responses[0] + for port, resp in responses[1:]: + assert resp.content == n_resp.content, f"HTTP response on {port} is not equal." + print(f"OK: HTTP responses for :{n_port}/ and :{port}/ are equal.") if __name__ == "__main__":