1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-07-31 13:50:23 +02:00

refactor: extract exception and cache middleware (#4248)

This commit is contained in:
Dag
2024-09-01 21:48:14 +02:00
committed by GitHub
parent 36fd72c87e
commit a6bdc322b0
8 changed files with 99 additions and 56 deletions

View File

@@ -23,6 +23,8 @@ final class RssBridge
$handler = $this->container[$actionName];
$middlewares = [
new CacheMiddleware($this->container['cache']),
new ExceptionMiddleware($this->container['logger']),
new SecurityMiddleware(),
new MaintenanceMiddleware(),
new BasicAuthMiddleware(),
@@ -34,6 +36,6 @@ final class RssBridge
foreach (array_reverse($middlewares) as $middleware) {
$action = fn ($req) => $middleware($req, $action);
}
return $action($request);
return $action($request->withAttribute('action', $actionName));
}
}