From 067d73e6cc19b2d22db0cff025dad5c8b524b85a Mon Sep 17 00:00:00 2001 From: Tam Nguyen Date: Thu, 29 Nov 2018 15:23:24 +0700 Subject: [PATCH] Only set CURLOPT_POSTFIELDS options if post data is not empty for DELETE method --- src/Curl/Curl.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php index 6986f29..38a2162 100644 --- a/src/Curl/Curl.php +++ b/src/Curl/Curl.php @@ -265,7 +265,9 @@ class Curl $this->setUrl($url, $query_parameters); $this->setOpt(CURLOPT_CUSTOMREQUEST, 'DELETE'); - $this->setOpt(CURLOPT_POSTFIELDS, $this->buildPostData($data)); + if (!empty($data)) { + $this->setOpt(CURLOPT_POSTFIELDS, $this->buildPostData($data)); + } return $this->exec(); }