Describe the bug
Using cork_send or send to send JSON causes socketify to infinitely hang when trying to JSON serialize a datetime object.
To Reproduce
Steps to reproduce the behavior:
- Run this sample code:
from socketify import App
import datetime
async def test(res, req):
data = [(586.9000244140625, 0, datetime.datetime(2025, 3, 1, 13, 29, 10)), (587.0, 644, datetime.datetime(2025, 3, 1, 13, 29, 10))]
res.cork_send(data, content_type=b"application/json")
def run(app: App):
app.get("/test", test)
- Go to your browser and load:
localhost:3000/test
- No response is produced and the browser tab infinitely spins/hangs.
Expected behavior
JSON should be sent back or there should be an error thrown by socketify rather than having no output.
Desktop (please complete the following information):
- OS: Ubuntu 24.04
- Browser: Brave (Chromium)
- Version: v1.75.181