aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/AppFramework/Http/TextPlainResponse.php
diff options
context:
space:
mode:
authorjld3103 <jld3103yt@gmail.com>2023-06-14 08:56:42 +0200
committerjld3103 <jld3103yt@gmail.com>2023-06-30 09:33:29 +0200
commitb0001c6010840362355c181b831b4517ac19b8fc (patch)
tree20e2e5194e3f780ceb9ed61bfbcdbc4df4de59c2 /lib/public/AppFramework/Http/TextPlainResponse.php
parent794d511774c28e6a8dc9d2a70d6968322140b70e (diff)
downloadnextcloud-server-b0001c6010840362355c181b831b4517ac19b8fc.tar.gz
nextcloud-server-b0001c6010840362355c181b831b4517ac19b8fc.zip
Add template types to responses
Signed-off-by: jld3103 <jld3103yt@gmail.com>
Diffstat (limited to 'lib/public/AppFramework/Http/TextPlainResponse.php')
-rw-r--r--lib/public/AppFramework/Http/TextPlainResponse.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/public/AppFramework/Http/TextPlainResponse.php b/lib/public/AppFramework/Http/TextPlainResponse.php
index 93edf704863..7bcd353e102 100644
--- a/lib/public/AppFramework/Http/TextPlainResponse.php
+++ b/lib/public/AppFramework/Http/TextPlainResponse.php
@@ -6,6 +6,7 @@ declare(strict_types=1);
* @copyright 2021 Lukas Reschke <lukas@statuscode.ch>
*
* @author 2021 Lukas Reschke <lukas@statuscode.ch>
+ * @author Kate Döen <kate.doeen@nextcloud.com>
*
* @license GNU AGPL version 3 or any later version
*
@@ -30,6 +31,9 @@ use OCP\AppFramework\Http;
/**
* A renderer for text responses
* @since 22.0.0
+ * @template S of int
+ * @template H of array<string, mixed>
+ * @template-extends Response<int, array<string, mixed>>
*/
class TextPlainResponse extends Response {
/** @var string */
@@ -38,14 +42,14 @@ class TextPlainResponse extends Response {
/**
* constructor of TextPlainResponse
* @param string $text The text body
- * @param int $statusCode the Http status code, defaults to 200
+ * @param S $statusCode the Http status code, defaults to 200
+ * @param H $headers
* @since 22.0.0
*/
- public function __construct(string $text = '', int $statusCode = Http::STATUS_OK) {
- parent::__construct();
+ public function __construct(string $text = '', int $statusCode = Http::STATUS_OK, array $headers = []) {
+ parent::__construct($statusCode, $headers);
$this->text = $text;
- $this->setStatus($statusCode);
$this->addHeader('Content-Type', 'text/plain');
}