protected function resetOutput()
    {
        if ($this->baseResponse instanceof GlobalEnvironmentInterface) {
            $this->baseResponse = $this->baseResponse->revive();
        }
        
        // Clear output buffer
        if (isset($this->baseResponse) && $this->baseResponse->getBody() instanceof OutputBufferStream) {
            $this->baseResponse = $this->baseResponse->withBody(clone $this->baseResponse->getBody());
        }
    }