From c637d0067e2bd9b6d28c2b46a8fd61e255f019cf Mon Sep 17 00:00:00 2001 From: andriusbaliutis Date: Fri, 2 Aug 2024 10:44:52 +0200 Subject: [PATCH 1/2] add validation for configureCurl method --- src/Request/Message/Body/JsonBody.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Request/Message/Body/JsonBody.php b/src/Request/Message/Body/JsonBody.php index bc909e9..bec15e0 100644 --- a/src/Request/Message/Body/JsonBody.php +++ b/src/Request/Message/Body/JsonBody.php @@ -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.'); From f8cc824c83bdc8dce85eac53f02797528b464925 Mon Sep 17 00:00:00 2001 From: andriusbaliutis Date: Fri, 2 Aug 2024 10:45:53 +0200 Subject: [PATCH 2/2] update readme.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e3ee9e3..6d5da0d 100644 --- a/README.md +++ b/README.md @@ -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" } } ```