diff --git a/http-server/Message/Stream.php b/http-server/Message/Stream.php index d0d05b33..c1ed7288 100644 --- a/http-server/Message/Stream.php +++ b/http-server/Message/Stream.php @@ -151,7 +151,6 @@ class Stream implements StreamInterface } - /** * @return bool */ @@ -165,9 +164,12 @@ class Stream implements StreamInterface * @param int $length * @return string */ - public function read($length): string + public function read($length = -1): string { - return substr($this->body, 0, $length); + if ($length > 0) { + return substr($this->body, 0, $length); + } + return $this->body; }