Description
A standard trick on Linux to pack response headers and body into a single TCP packet is to sendmsg() the headers with flags=MSG_MORE and sendfile() or splice() the body afterwards. That kind of optimized mix-and-match I/O is not something you can do with libuv.
In theory, libuv could apply the sendmsg+sendfile trick implicitly by correlating write and sendfile requests for the same file descriptor. That wouldn't need any new APIs but it would require deep cooperation between normal socket I/O and the thread pool. (The time gap between the system calls should be short in order to be effective. Wait too long and the kernel will flush the headers automatically. Then you not only have two TCP packets but also extra latency.)
Alternatively, one could conceive an "I/O plan" API that lets the user compile a sequence of I/O actions. I'm not sure what it would look like but it's potentially more general, extensible and reliable than applying heuristics.