Skip to content

Commit 38dc121

Browse files
wip accept jsonserializable in more responses
1 parent 32f04c4 commit 38dc121

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

packages/http/src/Responses/Created.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Tempest\Http\Responses;
66

7+
use JsonSerializable;
78
use Tempest\Http\IsResponse;
89
use Tempest\Http\Response;
910
use Tempest\Http\Status;
@@ -13,7 +14,7 @@ final class Created implements Response
1314
{
1415
use IsResponse;
1516

16-
public function __construct(string|array|null|View $body = null)
17+
public function __construct(string|array|null|View|JsonSerializable $body = null)
1718
{
1819
$this->status = Status::CREATED;
1920
$this->body = $body;

packages/http/src/Responses/NotFound.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Tempest\Http\Responses;
66

77
use Generator;
8+
use JsonSerializable;
89
use Tempest\Http\IsResponse;
910
use Tempest\Http\Response;
1011
use Tempest\Http\Status;
@@ -14,7 +15,7 @@ final class NotFound implements Response
1415
{
1516
use IsResponse;
1617

17-
public function __construct(View|Generator|string|array|null $body = null)
18+
public function __construct(View|JsonSerializable|Generator|string|array|null $body = null)
1819
{
1920
$this->status = Status::NOT_FOUND;
2021
$this->body = $body;

packages/http/src/Responses/Ok.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Tempest\Http\Responses;
66

77
use Generator;
8+
use JsonSerializable;
89
use Tempest\Http\IsResponse;
910
use Tempest\Http\Response;
1011
use Tempest\Http\Status;
@@ -14,7 +15,7 @@ final class Ok implements Response
1415
{
1516
use IsResponse;
1617

17-
public function __construct(View|Generator|string|array|null $body = null)
18+
public function __construct(View|JsonSerializable|Generator|string|array|null $body = null)
1819
{
1920
$this->status = Status::OK;
2021
$this->body = $body;

0 commit comments

Comments
 (0)