From 0747299851889c36d9ebbdc18fcda50fc0320805 Mon Sep 17 00:00:00 2001 From: Dane Lowe Date: Thu, 8 May 2014 14:21:54 +1200 Subject: [PATCH] Always add CURLOPT_POSTFIELDS for a POST request PHP seemed to be adding header ``Content-Length: -1 If a POST request has no CURLOPT_POSTFIELDS defined, causing a 400 Bad Request from GoCardless. --- lib/GoCardless/Request.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/GoCardless/Request.php b/lib/GoCardless/Request.php index 67d6028..02d7c81 100644 --- a/lib/GoCardless/Request.php +++ b/lib/GoCardless/Request.php @@ -125,11 +125,7 @@ protected static function call($method, $url, $params = array()) { // Curl options for POSt $curl_options[CURLOPT_POST] = 1; - - if ( ! empty($params)) { - $curl_options[CURLOPT_POSTFIELDS] = http_build_query($params, null, - '&'); - } + $curl_options[CURLOPT_POSTFIELDS] = http_build_query($params, null, '&'); } elseif ($method == 'get') { // Curl options for GET