Fix error on middleware set for DELETE method.
This commit is contained in:
parent
8a46d9a3c9
commit
831dd7ad47
@ -8,5 +8,3 @@ define('dbpass', '');
|
|||||||
|
|
||||||
define('ROOT_DIR', __DIR__);
|
define('ROOT_DIR', __DIR__);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
@ -159,6 +159,19 @@ class Router {
|
|||||||
return new static();
|
return new static();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define los routers para el método PUT.
|
||||||
|
*
|
||||||
|
* @param string $path
|
||||||
|
* URI con pseudovariables
|
||||||
|
*
|
||||||
|
* @param function $callback
|
||||||
|
* Función en formato Clase::Método que será llamada cuando la url y el método coincidan
|
||||||
|
*
|
||||||
|
* @return static
|
||||||
|
* Devuelve un enlace estático
|
||||||
|
*/
|
||||||
|
|
||||||
public static function put($path, $callback) {
|
public static function put($path, $callback) {
|
||||||
static::$put[] = static::parse($path, $callback);
|
static::$put[] = static::parse($path, $callback);
|
||||||
static::$last = ['put', count(static::$put)-1];
|
static::$last = ['put', count(static::$put)-1];
|
||||||
@ -179,14 +192,13 @@ class Router {
|
|||||||
*/
|
*/
|
||||||
public static function delete($path, $callback) {
|
public static function delete($path, $callback) {
|
||||||
static::$delete[] = static::parse($path, $callback);
|
static::$delete[] = static::parse($path, $callback);
|
||||||
static::$last = ['delete', count(static::$put)-1];
|
static::$last = ['delete', count(static::$delete)-1];
|
||||||
return new static();
|
return new static();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Devuelve el URI path actual
|
* Devuelve el URI path actual
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static function URIPath() {
|
public static function URIPath() {
|
||||||
return preg_replace('/'.preg_quote(static::baseURI(), '/').'/',
|
return preg_replace('/'.preg_quote(static::baseURI(), '/').'/',
|
||||||
'/', strtok($_SERVER['REQUEST_URI'], '?'), 1);
|
'/', strtok($_SERVER['REQUEST_URI'], '?'), 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user