This static helper function doesn't take into account that the caller (e.g. router) might have had its stream reset between encodeHeaders() and encodeData(). This is worked around in #1282 for router replies in the context of Http::AsyncClientImpl, but probably deserves a more complete solution.