A FastAPI middleware can return a response before a streaming response has finished sending its body. That is the shorthand behind this headline: the middleware can inspect the response object, yet still not have seen every byte the client will receive. To understand why, think of middleware as a wrapper around an ASGI application, not […]