diff --git a/Log/LogRequest.php b/Log/LogRequest.php index 444f318..1f9b6bd 100644 --- a/Log/LogRequest.php +++ b/Log/LogRequest.php @@ -100,7 +100,15 @@ protected function save(RequestInterface $request) { $this->setHeaders($request->getHeaders()); $this->setProtocolVersion($request->getProtocolVersion()); $this->setMethod($request->getMethod()); + + if($request->getBody()->isSeekable()) { + $readPosition = $request->getBody()->tell(); + } $this->setBody($request->getBody() ? $request->getBody()->__toString() : null); + if($request->getBody()->isSeekable()) { + $request->getBody()->seek($readPosition); + } + } // end: save() /** diff --git a/Log/LogResponse.php b/Log/LogResponse.php index 2ba96eb..d3c369d 100644 --- a/Log/LogResponse.php +++ b/Log/LogResponse.php @@ -67,7 +67,15 @@ public function save(ResponseInterface $response) { $this->setStatusCode($response->getStatusCode()); $this->setStatusPhrase($response->getReasonPhrase()); + + if($response->getBody()->isSeekable()) { + $readPosition = $response->getBody()->tell(); + } $this->setBody($response->getBody()->__toString()); + if($response->getBody()->isSeekable()) { + $response->getBody()->seek($readPosition); + } + $this->setHeaders($response->getHeaders()); $this->setProtocolVersion($response->getProtocolVersion()); } // end: save()