response = $response; // Slim adds Authorization header. It's not needed. $this->response = $this->response->withoutHeader('Authorization'); } public function setStatus(int $code, ?string $reason = null) { $this->response = $this->response->withStatus($code, $reason ?? ''); } public function setHeader(string $name, string $value) { $this->response = $this->response->withHeader($name, $value); } public function getHeader(string $name) : ?string { if (!$this->response->hasHeader($name)) return null; return $this->response->getHeaderLine($name); } public function hasHeader(string $name) : bool { return $this->response->hasHeader($name); } public function getResponse() : Psr7Response { return $this->response; } public function writeBody(string $string) { $this->response->getBody()->write($string); } public function setBody(StreamInterface $body) { $this->response->setBody($body); } }