Skip to content

Commit

Permalink
Fix: Avoid array to string conversion for non-string body matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariano Custiel committed Jun 2, 2021
1 parent 303add6 commit 02dcd32
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Domain/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,18 @@ class Request implements \JsonSerializable

public function __toString()
{
if (isset($this->body)) {
$bodyValue = $this->body->getValue();
if (!is_string($bodyValue)) {
$bodyValue = print_r($bodyValue, true);
}
}

return print_r(
[
'method' => $this->method,
'url' => isset($this->url) ? $this->url->__toString() : 'null',
'body' => isset($this->body) ? $this->body->getMatcher() . ' => ' . (isset($this->body->getValue()[5000]) ? '--VERY LONG CONTENTS--' : $this->body->getValue()) : 'null',
'body' => isset($this->body) ? $this->body->getMatcher() . ' => ' . (isset($bodyValue[5000]) ? '--VERY LONG CONTENTS--' : $bodyValue) : 'null',
'headers' => print_r($this->headers, true),
],
true
Expand Down

0 comments on commit 02dcd32

Please sign in to comment.