Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ A JSON HTTP client library. This project also is the reference implementation fo
```{json}
{
"require": {
"chroma-x/json-http-client": "~3.0"
"chroma-x/json-http-client": "~4.0"
}
}
```
Expand Down
6 changes: 5 additions & 1 deletion src/Request/Message/Body/JsonBody.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ public function __construct(array $bodyData)
$this->bodyData = $bodyData;
}

public function configureCurl(\CurlHandle $curl): self
public function configureCurl(\CurlHandle|false $curl): self
{
if ($curl === false) {
throw new \TypeError('cURL is not a valid CurlHandle class.');
}

$jsonBody = json_encode($this->bodyData);
if ($jsonBody === false) {
throw new HttpRequestMessageException('JSON body data not serializable.');
Expand Down