public function emitBody(ResponseInterface $response)
    {
        $output = $this->createOutputStream();
        
        if (!$output) {
            throw new \RuntimeException("Failed to open output stream");
        }
        
        $response->getBody()->rewind();
        $handle = $response->getBody()->detach();
        
        stream_copy_to_stream($handle, $output);
    }