Skip to content

Commit f3e14fa

Browse files
authored
Merge pull request #116 from foremtehan/patch-3
improve: avoid invalid decoded response body in Response of http client
2 parents e50c4c9 + 8c03203 commit f3e14fa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/http-client/src/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function body(): string
6464
public function json(?string $key = null, mixed $default = null): mixed
6565
{
6666
if (! $this->decoded) {
67-
$this->decoded = json_decode($this->body(), true);
67+
$this->decoded = json_decode($this->body(), true) ?? [];
6868
}
6969

7070
if (is_null($key)) {

0 commit comments

Comments
 (0)