diff --git a/http-server/Message/Stream.php b/http-server/Message/Stream.php index c7ba2bc6..c1ed7288 100644 --- a/http-server/Message/Stream.php +++ b/http-server/Message/Stream.php @@ -134,7 +134,7 @@ class Stream implements StreamInterface public function write($string): int { $this->body = $string; - $this->size = 0; + $this->size = strlen($this->body); return $this->size; } @@ -146,7 +146,7 @@ class Stream implements StreamInterface public function append(string $string): int { $this->body .= $string; - $this->size = 0; + $this->size = strlen($this->body); return $this->size; } diff --git a/http-server/Service/Http.php b/http-server/Service/Http.php index 34919bf7..5fb0bc70 100644 --- a/http-server/Service/Http.php +++ b/http-server/Service/Http.php @@ -75,7 +75,7 @@ class Http extends \Server\Abstracts\Http implements OnClose, OnConnect $responseData = Help::toXml($responseData); } if (is_array($responseData)) { - $interface->stream->write(json_encode($responseData, JSON_UNESCAPED_UNICODE)); + $interface->stream->write(json_encode($responseData)); } else { $interface->stream->write((string)$responseData); }