Fixes race condition: for text stream responses, guarantees that header is printed before the stream data.