Skip to content

Commit

Permalink
レスポンス処理の共通化
Browse files Browse the repository at this point in the history
  • Loading branch information
take64 committed Jul 20, 2023
1 parent 1d4195e commit f7a07a9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Citrus\CitrusException;
use Citrus\Http\Server\Request;
use Citrus\Http\Server\Response;
use Citrus\Http\Server\ResponseTo;
use Citrus\Logger;
use Citrus\Message;
use Citrus\Message\MessageItem;
Expand Down Expand Up @@ -46,6 +47,7 @@ public function run(Router|null $router = null): void

$request = Request::generate();
$this->initialize($request);
/** @var ResponseTo $response */
$response = $this->$action_name($request);
$this->release($request);
if (true === Message::exists())
Expand All @@ -65,7 +67,7 @@ public function run(Router|null $router = null): void
$response_json = json_encode($response);

// 出力
echo $response_json;
echo $response->toJson();
}

/**
Expand Down

0 comments on commit f7a07a9

Please sign in to comment.