protected function hasRedirect(): bool
    {
        $headers = $this->getResponse()->getHeaders();
        if (isset($headers['Location'])
            || isset($headers['location'])
        ) {
            return true;
        }

        //we need to also check the PHP headers
        foreach (headers_list() as $header) {
            //if there was a redirect set
            if (strpos(strtolower($header), 'location:') === 0) {
                return true;
            }
        }

        //no redirect was found
        return false;
    }