mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
Ignore case on plugin route method
This commit is contained in:
parent
937af536b6
commit
6785ecad1d
@ -66,7 +66,8 @@ class Plugins {
|
||||
if ($method !== '*') {
|
||||
$methods = is_string($method) ? explode(',', $info['method']) : $method;
|
||||
foreach ($methods as $method) {
|
||||
if (!in_array($method, ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD'])) {
|
||||
$method = strtolower($method);
|
||||
if (!in_array($method, ['get', 'post', 'put', 'patch', 'delete', 'head'])) {
|
||||
self::$warnings[] = $warningPreTitle . 'Not allowed method ' . $method . '... Disabling this route...';
|
||||
}
|
||||
}
|
||||
|
@ -115,6 +115,18 @@ $dispatcher = FastRoute\cachedDispatcher(function (FastRoute\RouteCollector $r)
|
||||
if ($route[0] === '*') {
|
||||
$route[0] = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD'];
|
||||
}
|
||||
else {
|
||||
if (is_string($route[0])) {
|
||||
$route[0] = explode(',', $route[0]);
|
||||
}
|
||||
|
||||
$toUpperCase = function(string $value): string {
|
||||
return trim(strtoupper($value));
|
||||
};
|
||||
|
||||
// convert to upper case, fast-route accepts only upper case
|
||||
$route[0] = array_map($toUpperCase, $route[0]);
|
||||
}
|
||||
|
||||
$aliases = [
|
||||
[':int', ':string', ':alphanum'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user