FastLED 3.9.15
Loading...
Searching...
No Matches

◆ send_request()

RequestResult test_client.send_request ( httpx.Client client,
str url,
TestConfig config )
Send HTTP GET request and measure response time.

Definition at line 75 of file test_client.py.

75def send_request(client: httpx.Client, url: str, config: TestConfig) -> RequestResult:
76 """Send HTTP GET request and measure response time."""
77 try:
78 start_time = time.perf_counter()
79 response = client.get(url, timeout=config.timeout)
80 elapsed_ms = (time.perf_counter() - start_time) * 1000
81
82 return RequestResult(
83 success=response.status_code == 200,
84 status_code=response.status_code,
85 response_text=response.text.strip(),
86 response_time_ms=elapsed_ms,
87 )
88 except httpx.ConnectError:
89 return RequestResult(False, None, None, 0.0, "Connection refused")
90 except httpx.TimeoutException:
91 return RequestResult(False, None, None, 0.0, "Request timeout")
92 except KeyboardInterrupt:
93 _thread.interrupt_main()
94 raise
95 except Exception as e:
96 return RequestResult(False, None, None, 0.0, str(e))
97
98

Referenced by run_tests(), and test_network_example().

+ Here is the caller graph for this function: