Skip to content

Commit 970e4ab

Browse files
committed
Update HttpBodyTrait.php
1 parent d4b3e8b commit 970e4ab

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Traits/HttpBodyTrait.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ public function withAddedBody(string $body): object
4545
*/
4646
public function withBodyJson($body): object
4747
{
48+
if (!$this->hasHeader('Content-Type')) {
49+
$this->withHeader('Content-Type', 'application/json');
50+
}
4851
return $this->withBody(json_encode($body));
4952
}
5053

0 commit comments

Comments
 (0)