response = $response; // Slim adds Authorization header. It's not needed. $this->response = $this->response->withoutHeader('Authorization'); } public function setStatus(int $code, ?string $reason = null) : Response { $this->response = $this->response->withStatus($code, $reason ?? ''); return $this; } public function setHeader(string $name, string $value) : Response { $this->response = $this->response->withHeader($name, $value); return $this; } 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) : Response { $this->response->getBody()->write($string); return $this; } public function setBody(StreamInterface $body) : Response { $this->response = $this->response->withBody($body); return $this; } }