MCPcopy Create free account
hub / github.com/cloudflare/cloudflared / stream_request

Method stream_request

component-tests/test_termination.py:112–127  ·  view source on GitHub ↗
(self, config, connected, early_terminate)

Source from the content-addressed store, hash-verified

110 assert minimum <= int(duration) <= self.grace_period
111
112 def stream_request(self, config, connected, early_terminate):
113 expected_terminate_message = "502 Bad Gateway"
114 url = config.get_url() + self.sse_endpoint
115
116 with requests.get(url, timeout=5, stream=True) as resp:
117 with connected:
118 connected.notifyAll()
119 lines = 0
120 for line in resp.iter_lines():
121 if expected_terminate_message.encode() == line:
122 break
123 lines += 1
124 if early_terminate and lines == 2:
125 return
126 # /sse returns count followed by 2 new lines
127 assert lines >= (self.grace_period * 2)

Callers

nothing calls this directly

Calls 3

get_urlMethod · 0.80
getMethod · 0.80
encodeMethod · 0.45

Tested by

no test coverage detected