Tests: style.

This commit is contained in:
Andrei Zeliankou
2021-04-05 14:03:05 +01:00
parent 46d8567dd7
commit 6c97a1a069
67 changed files with 689 additions and 614 deletions

View File

@@ -3,16 +3,16 @@ async def application(scope, receive, send):
while True:
m = await receive()
if m['type'] == 'websocket.connect':
await send({
'type': 'websocket.accept',
})
await send({'type': 'websocket.accept'})
if m['type'] == 'websocket.receive':
await send({
'type': 'websocket.send',
'bytes': m.get('bytes', None),
'text': m.get('text', None),
})
await send(
{
'type': 'websocket.send',
'bytes': m.get('bytes', None),
'text': m.get('text', None),
}
)
if m['type'] == 'websocket.disconnect':
break;
break

View File

@@ -6,20 +6,24 @@ async def application(scope, receive, send):
if m['type'] == 'websocket.connect':
subprotocols = scope['subprotocols']
await send({
'type': 'websocket.accept',
'headers': [
(b'x-subprotocols', str(subprotocols).encode()),
],
'subprotocol': subprotocols[0],
})
await send(
{
'type': 'websocket.accept',
'headers': [
(b'x-subprotocols', str(subprotocols).encode()),
],
'subprotocol': subprotocols[0],
}
)
if m['type'] == 'websocket.receive':
await send({
'type': 'websocket.send',
'bytes': m.get('bytes', None),
'text': m.get('text', None),
})
await send(
{
'type': 'websocket.send',
'bytes': m.get('bytes', None),
'text': m.get('text', None),
}
)
if m['type'] == 'websocket.disconnect':
break;
break