Support binary data in the SSE extension

This commit is contained in:
Miguel Grinberg
2023-12-28 12:04:17 +00:00
parent 79452a4699
commit 1fc11193da
2 changed files with 17 additions and 5 deletions

View File

@@ -26,6 +26,7 @@ class TestWebSocket(unittest.TestCase):
await sse.send({'foo': 'bar'})
await sse.send([42, 'foo', 'bar'])
await sse.send(ValueError('foo'))
await sse.send(b'foo')
client = TestClient(app)
response = self._run(client.get('/sse'))
@@ -35,4 +36,5 @@ class TestWebSocket(unittest.TestCase):
'event: test\ndata: bar\n\n'
'data: {"foo": "bar"}\n\n'
'data: [42, "foo", "bar"]\n\n'
'data: foo\n\n'
'data: foo\n\n'))