*/
protected $type = self::TYPE_HTML;
+ protected $status = 200;
+
+ protected $reason = null;
+
/**
* {@inheritDoc}
*/
}
switch ($type) {
+ case static::TYPE_HTML:
+ $content_type = $content_type ?? 'text/html';
+ break;
case static::TYPE_JSON:
$content_type = $content_type ?? 'application/json';
break;
$this->type = $type;
}
+ /**
+ * {@inheritDoc}
+ */
+ public function setStatus(int $status = 200, ?string $reason = null): void
+ {
+ $this->status = $status;
+ $this->reason = $reason;
+ }
+
/**
* {@inheritDoc}
*/
// Setting the response type as an X-header for direct usage
$this->headers[static::X_HEADER] = $this->type;
- return new \GuzzleHttp\Psr7\Response(200, $this->headers, $this->content);
+ return new \GuzzleHttp\Psr7\Response($this->status, $this->headers, $this->content, '1.1', $this->reason);
}
}