private function reformatLocationHeader(ResponseInterface $response) { $location = $response->getHeader('Location'); if ($location && !preg_match('/^http[s]?:\\/\\//', $location)) { $response->setHeader('Location', $this->config->getConfig('site_protocol') . '://' . $this->config->getConfig('site_domain') . $location); } }
function renderFor($resource_name, ResponseInterface $response, RequestInterface $request) { $templates = $this->package_provider->getTemplatesFor($resource_name, $request); if (!$templates['template'] instanceof TemplateInterface) { $response->setStatus(406); } else { $response->setContent($this->renderer->renderTemplate($templates['template'], $response->getContent(), $templates['layout'])); $response->setHeader('Content-Type', $templates['mime-type']); } return $response; }