MCPcopy
hub / github.com/streamlit/streamlit / handle_response

Function handle_response

e2e_playwright/basic_app_test.py:50–62  ·  view source on GitHub ↗
(response: Response)

Source from the content-addressed store, hash-verified

48 total_size_bytes = 0
49
50 def handle_response(response: Response):
51 nonlocal total_size_bytes
52 try:
53 # First try content-length header
54 content_length = response.headers.get("content-length")
55 if content_length:
56 total_size_bytes += int(content_length)
57 else:
58 # If that fails, read the body (expensive for large files)
59 body = response.body()
60 total_size_bytes += len(body)
61 except Exception as ex:
62 print(f"Error calculating size of web assets: {ex}")
63
64 # Register the response handler
65 page.on("response", handle_response)

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…