public function prepareHeaders($requestHeaders)
    {
        $responseHeaders = [];

        if (isset($requestHeaders['Origin'], $this->_cors['Origin'])) {
            if (in_array('*', $this->_cors['Origin']) || in_array($requestHeaders['Origin'], $this->_cors['Origin'])) {
                $responseHeaders['Access-Control-Allow-Origin'] = $requestHeaders['Origin'];
            }
        }

        $this->prepareAllowHeaders('Headers', $requestHeaders, $responseHeaders);

        if (isset($requestHeaders['Access-Control-Request-Method'])) {
            $responseHeaders['Access-Control-Allow-Methods'] = implode(', ', $this->_cors['Access-Control-Request-Method']);
        }

        if (isset($this->_cors['Access-Control-Allow-Credentials'])) {
            $responseHeaders['Access-Control-Allow-Credentials'] = $this->_cors['Access-Control-Allow-Credentials'] ? 'true' : 'false';
        }

        if (isset($this->_cors['Access-Control-Max-Age']) && $this->isOptions()) {
            $responseHeaders['Access-Control-Max-Age'] = $this->_cors['Access-Control-Max-Age'];
        }

        if (isset($this->_cors['Access-Control-Expose-Headers'])) {
            $responseHeaders['Access-Control-Expose-Headers'] = implode(', ', $this->_cors['Access-Control-Expose-Headers']);
        }

        return $responseHeaders;
    }