@@ -50,16 +50,12 @@ public function execute($requestMethod, $url, $parameters = null, $extraOptions
50
50
break ;
51
51
52
52
case 'POST ' :
53
- if ($ parameters && is_array ($ parameters )) {
54
- curl_setopt ($ curl , CURLOPT_POSTFIELDS , json_encode ($ parameters ));
55
- } else {
56
- $ customHeaders [] = 'Content-Length: 0 ' ;
57
-
58
- // Suppress "Transfer-Encoding: chunked" header automatically added by cURL that
59
- // causes a 400 bad request (bad content-length).
60
- $ customHeaders [] = 'Transfer-Encoding: ' ;
53
+ if ( ! $ parameters || ! is_array ($ parameters )) {
54
+ $ parameters = array ();
61
55
}
62
56
57
+ curl_setopt ($ curl , CURLOPT_POSTFIELDS , json_encode ($ parameters ));
58
+
63
59
// Suppress "Expect: 100-continue" header automatically added by cURL that
64
60
// causes a 1 second delay if the remote server does not support Expect.
65
61
$ customHeaders [] = 'Expect: ' ;
@@ -72,16 +68,12 @@ public function execute($requestMethod, $url, $parameters = null, $extraOptions
72
68
break ;
73
69
74
70
case 'PUT ' :
75
- if ($ parameters && is_array ($ parameters )) {
76
- curl_setopt ($ curl , CURLOPT_POSTFIELDS , json_encode ($ parameters ));
77
- } else {
78
- $ customHeaders [] = 'Content-Length: 0 ' ;
79
-
80
- // Suppress "Transfer-Encoding: chunked" header automatically added by cURL that
81
- // causes a 400 bad request (bad content-length).
82
- $ customHeaders [] = 'Transfer-Encoding: ' ;
71
+ if ( ! $ parameters || ! is_array ($ parameters )) {
72
+ $ parameters = array ();
83
73
}
84
74
75
+ curl_setopt ($ curl , CURLOPT_POSTFIELDS , json_encode ($ parameters ));
76
+
85
77
// Suppress "Expect: 100-continue" header automatically added by cURL that
86
78
// causes a 1 second delay if the remote server does not support Expect.
87
79
$ customHeaders [] = 'Expect: ' ;
0 commit comments