Spot the bug in the ASGI echo application

from WSGI and ASGI
Python 3.14 intermediate 4 min 2 issues to find

This raw ASGI application should echo the complete request body. Find the two protocol bugs.

Python
async def application(scope, receive, send):
    message = await receive()
    body = message.get("body", b"")

    await send({
        "type": "http.response.start",
        "status": 200,
        "headers": {"content-type": "text/plain"},
    })
    await send({
        "type": "http.response.body",
        "body": body,
    })
Open in playground
Report an error