Skip to content

Commit 4eee6fa

Browse files
committed
Handle Stream
1 parent 5d62cc5 commit 4eee6fa

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Handler/Logging.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use ErrorHeroModule\Handler\Formatter\Json;
99
use ErrorHeroModule\Handler\Writer\Mail;
1010
use ErrorHeroModule\HeroConstant;
11+
use Laminas\Diactoros\Stream;
1112
use Laminas\Http\Header\Cookie;
1213
use Laminas\Http\PhpEnvironment\RemoteAddress;
1314
use Laminas\Http\PhpEnvironment\Request as HttpRequest;
@@ -90,10 +91,16 @@ private function getRequestData(?RequestInterface $request): array
9091
/** @var ParametersInterface $files*/
9192
$files = $request->getFiles();
9293

94+
$content = $request->getContent();
95+
96+
if ($content instanceof Stream) {
97+
$content = (string) $content;
98+
}
99+
93100
$queryData = $query->toArray();
94101
$requestMethod = $request->getMethod();
95102
$bodyData = $post->toArray();
96-
$rawData = str_replace(PHP_EOL, '', $request->getContent());
103+
$rawData = str_replace(PHP_EOL, '', $content);
97104
$filesData = $this->includeFilesToAttachments
98105
? $files->toArray()
99106
: [];

0 commit comments

Comments
 (0)