Skip to content

Commit 96a0481

Browse files
Merge pull request #35 from FacturAPI/hotfix/conditional_body_put
fix(conditionalPut): add ternary in $body for encode json or send null
2 parents 64d041c + 93c685b commit 96a0481

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Http/BaseClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ protected function execute_JSON_put_request($url, $body)
244244
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
245245
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
246246
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
247-
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
247+
curl_setopt($ch, CURLOPT_POSTFIELDS, $body ? json_encode($body) : null);
248248
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
249249

250250
$result = curl_exec($ch);

0 commit comments

Comments
 (0)