@@ -38,21 +38,6 @@ class cURL
3838 */
3939 protected $ ch ;
4040
41- /**
42- * Allowed methods => allows postdata
43- *
44- * @var array
45- */
46- protected $ methods = array (
47- 'get ' => false ,
48- 'head ' => false ,
49- 'post ' => true ,
50- 'put ' => true ,
51- 'patch ' => true ,
52- 'delete ' => false ,
53- 'options ' => false ,
54- );
55-
5641 /**
5742 * The request class to use.
5843 *
@@ -88,7 +73,7 @@ class cURL
8873 */
8974 public function getAllowedMethods ()
9075 {
91- return $ this -> methods ;
76+ return Request:: $ methods ;
9277 }
9378
9479 /**
@@ -278,7 +263,7 @@ public function prepareRequest(Request $request)
278263
279264 curl_setopt ($ this ->ch , CURLOPT_HTTPHEADER , $ request ->formatHeaders ());
280265
281- if ($ this -> methods [ $ method ] === true ) {
266+ if ($ request -> hasData () ) {
282267 curl_setopt ($ this ->ch , CURLOPT_POSTFIELDS , $ request ->encodeData ());
283268 }
284269
@@ -358,7 +343,7 @@ public function __call($func, $args)
358343 $ method = substr ($ method , 3 );
359344 }
360345
361- if (!array_key_exists ($ method , $ this -> methods )) {
346+ if (!array_key_exists ($ method , Request:: $ methods )) {
362347 throw new \BadMethodCallException ("Method [ $ method] not a valid HTTP method. " );
363348 }
364349
@@ -368,9 +353,6 @@ public function __call($func, $args)
368353 $ url = $ args [0 ];
369354
370355 if (isset ($ args [1 ])) {
371- if (!$ this ->methods [$ method ]) {
372- throw new \InvalidArgumentException ("HTTP method [ $ method] does not allow POST data. " );
373- }
374356 $ data = $ args [1 ];
375357 } else {
376358 $ data = null ;
0 commit comments