111
This commit is contained in:
@@ -64,7 +64,7 @@ class Http extends \Server\Abstracts\Http implements OnClose, OnConnect
|
|||||||
*/
|
*/
|
||||||
private function transferToResponse($responseData): ResponseInterface
|
private function transferToResponse($responseData): ResponseInterface
|
||||||
{
|
{
|
||||||
$this->response->withStatus(200);
|
$interface = $this->response->withStatus(200);
|
||||||
if (is_object($responseData)) {
|
if (is_object($responseData)) {
|
||||||
if (!($responseData instanceof ToArray)) {
|
if (!($responseData instanceof ToArray)) {
|
||||||
$responseData = get_object_vars($responseData);
|
$responseData = get_object_vars($responseData);
|
||||||
@@ -73,11 +73,10 @@ class Http extends \Server\Abstracts\Http implements OnClose, OnConnect
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (is_array($responseData)) {
|
if (is_array($responseData)) {
|
||||||
return $this->response->withBody(new Stream(json_encode($responseData, JSON_UNESCAPED_UNICODE)))
|
return $interface->withBody(new Stream(json_encode($responseData, JSON_UNESCAPED_UNICODE)))
|
||||||
->withContentType(\Server\Message\Response::CONTENT_TYPE_JSON);
|
->withContentType(\Server\Message\Response::CONTENT_TYPE_JSON);
|
||||||
}
|
}
|
||||||
return $this->response->withBody(new Stream((string)$responseData))
|
return $interface->withBody(new Stream((string)$responseData));
|
||||||
->withContentType(\Server\Message\Response::CONTENT_TYPE_HTML);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user