MCPcopy
hub / github.com/aio-libs/aiohttp / gen_ws_headers

Function gen_ws_headers

tests/test_websocket_handshake.py:24–32  ·  view source on GitHub ↗
(protocols='')

Source from the content-addressed store, hash-verified

22
23
24def gen_ws_headers(protocols=''):
25 key = base64.b64encode(os.urandom(16)).decode()
26 hdrs = [('UPGRADE', 'websocket'),
27 ('CONNECTION', 'upgrade'),
28 ('SEC-WEBSOCKET-VERSION', '13'),
29 ('SEC-WEBSOCKET-KEY', key)]
30 if protocols:
31 hdrs += [('SEC-WEBSOCKET-PROTOCOL', protocols)]
32 return hdrs, key
33
34
35def test_not_get(message, transport):

Callers 4

test_handshakeFunction · 0.85
test_handshake_protocolFunction · 0.85

Calls 1

decodeMethod · 0.80

Tested by

no test coverage detected