@@ -31,6 +31,13 @@ abstract class REST_Controller extends CI_Controller
3131 */
3232 protected $ methods = array ();
3333
34+ /**
35+ * List of allowed HTTP methods
36+ *
37+ * @var array
38+ */
39+ protected $ allowed_http_methods = array ('get ' , 'delete ' , 'post ' , 'put ' );
40+
3441 /**
3542 * General request data and information.
3643 * Stores accept, language, body, headers, etc.
@@ -320,7 +327,7 @@ public function response($data = array(), $http_code = null)
320327 {
321328 $ http_code = 404 ;
322329
323- //create the output variable here in the case of $this->response(array());
330+ // create the output variable here in the case of $this->response(array());
324331 $ output = NULL ;
325332 }
326333
@@ -492,7 +499,7 @@ protected function _detect_output_format()
492499 /**
493500 * Detect method
494501 *
495- * Detect which method (POST, PUT, GET, DELETE) is being used
502+ * Detect which HTTP method is being used
496503 *
497504 * @return string
498505 */
@@ -512,7 +519,7 @@ protected function _detect_method()
512519 }
513520 }
514521
515- if (in_array ($ method , array ( ' get ' , 'delete ' , ' post ' , ' put ' ) ))
522+ if (in_array ($ method , $ this -> allowed_http_methods ) && method_exists ( $ this , '_parse_ ' . $ method ))
516523 {
517524 return $ method ;
518525 }
0 commit comments