MCPcopy
hub / github.com/encode/uvicorn / get_connected_protocol

Function get_connected_protocol

tests/protocols/test_http.py:264–277  ·  tests/protocols/test_http.py::get_connected_protocol
(
    app: ASGIApplication,
    http_protocol_cls: type[HTTPProtocol],
    lifespan: LifespanOff | LifespanOn | None = None,
    **kwargs: Any,
)

Source from the content-addressed store, hash-verified

262
263
264def get_connected_protocol(
265 app: ASGIApplication,
266 http_protocol_cls: type[HTTPProtocol],
267 lifespan: LifespanOff | LifespanOn | None = None,
268 **kwargs: Any,
269) -> MockProtocol:
270 loop = MockLoop()
271 transport = MockTransport()
272 config = Config(app=app, **kwargs)
273 lifespan = lifespan or LifespanOff(config)
274 server_state = ServerState()
275 protocol = http_protocol_cls(config=config, server_state=server_state, app_state=lifespan.state, _loop=loop) class="cm"># type: ignore
276 protocol.connection_made(transport) class="cm"># type: ignore[arg-type]
277 return protocol class="cm"># type: ignore[return-value]
278
279
280async def test_get_request(http_protocol_cls: type[HTTPProtocol]):

Callers 15

test_get_requestFunction · 0.70
test_invalid_header_nameFunction · 0.70
test_request_loggingFunction · 0.70
test_head_requestFunction · 0.70
test_post_requestFunction · 0.70
test_keepaliveFunction · 0.70
test_keepalive_timeoutFunction · 0.70
test_closeFunction · 0.70
test_chunked_encodingFunction · 0.70

Calls 7

ConfigClass · 0.90
LifespanOffClass · 0.90
ServerStateClass · 0.90
http_protocol_clsFunction · 0.85
MockLoopClass · 0.70
MockTransportClass · 0.70
connection_madeMethod · 0.45

Tested by

no test coverage detected