Example #1
0
 /**
  * Matches a PUT request,
  * Callback is called with regex matches + decoded post body
  * @param $path
  * @param callable $callback function(match[1], match[2], ..., <$post_body>)
  * @throws \Exception
  */
 public function PUT($path, $callback)
 {
     if (!is_callable($callback)) {
         throw new \Exception(sprintf(_('%s: Invalid callback'), $callback), 500);
     }
     $this->route("PUT {$path}", function () use($callback) {
         $args = func_get_args();
         $args[] = Router::parse_post_body();
         return call_user_func_array($callback, $args);
     });
 }