diff --git a/src/Traits/HttpBodyTrait.php b/src/Traits/HttpBodyTrait.php index b95b230..2b28a9f 100644 --- a/src/Traits/HttpBodyTrait.php +++ b/src/Traits/HttpBodyTrait.php @@ -45,6 +45,9 @@ public function withAddedBody(string $body): object */ public function withBodyJson($body): object { + if (!$this->hasHeader('Content-Type')) { + $this->withHeader('Content-Type', 'application/json'); + } return $this->withBody(json_encode($body)); }