Skip to content

Commit b7ef6d9

Browse files
committed
fix: (http/conn) When the body is empty, json_decode will throw an error.
1 parent 6cb1210 commit b7ef6d9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/Net/Http/Server/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ private function parseRequestBody(): void
521521
{
522522
if ($this->method->value === 'POST') {
523523
if (str_contains($this->contentType, 'application/json')) {
524-
$this->post = array_merge($this->post, json_decode($this->content, true) ?? []);
524+
$this->post = array_merge($this->post, json_decode($this->content ?? '', true) ?? []);
525525
} elseif ($this->contentType === 'application/x-www-form-urlencoded') {
526526
parse_str($this->content, $this->post);
527527
}

0 commit comments

Comments
 (0)