Skip to content

Commit

Permalink
Update BaseController.php
Browse files Browse the repository at this point in the history
  • Loading branch information
kaioken authored Dec 29, 2018
1 parent e580994 commit 10267ab
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Rest/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public function response($content, int $statusCode = 200, string $statusMessage
}

// Create a response since it's an ajax
$response = new Response();
//in order to use the current response instead of having to create a new object , this is needed for swoole servers
$response = $this->response ?? new Response();
$response->setStatusCode($statusCode, $statusMessage);
$response->setContentType('application/vnd.api+json', 'UTF-8');
$response->setJsonContent($content);
Expand Down

0 comments on commit 10267ab

Please sign in to comment.