Enable Discovery debug logging for production troubleshooting
- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Framework\Http\Middlewares;
|
||||
@@ -7,7 +8,9 @@ use App\Framework\Http\HttpMiddleware;
|
||||
use App\Framework\Http\MiddlewareContext;
|
||||
use App\Framework\Http\MiddlewarePriority;
|
||||
use App\Framework\Http\MiddlewarePriorityAttribute;
|
||||
use App\Framework\Http\Next;
|
||||
use App\Framework\Http\RequestStateManager;
|
||||
use App\Framework\Http\StateKey;
|
||||
use App\Framework\Router\RouteResponder;
|
||||
|
||||
#[MiddlewarePriorityAttribute(MiddlewarePriority::ROUTING, -1)]
|
||||
@@ -15,50 +18,26 @@ final readonly class ResponseGeneratorMiddleware implements HttpMiddleware
|
||||
{
|
||||
public function __construct(
|
||||
private RouteResponder $responder,
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
public function __invoke(MiddlewareContext $context, callable $next, RequestStateManager $stateManager): MiddlewareContext
|
||||
public function __invoke(MiddlewareContext $context, Next $next, RequestStateManager $stateManager): MiddlewareContext
|
||||
{
|
||||
$request = $context->request;
|
||||
|
||||
if($stateManager->has('controllerResult')) {
|
||||
$originalResponse = $this->responder->respond($stateManager->get('controllerResult'));
|
||||
if ($stateManager->has(StateKey::CONTROLLER_RESULT)) {
|
||||
$controllerResult = $stateManager->get(StateKey::CONTROLLER_RESULT);
|
||||
$originalResponse = $this->responder->respond($controllerResult);
|
||||
|
||||
// Kontext mit der generierten Response aktualisieren
|
||||
$updatedContext = $context->withResponse($originalResponse);
|
||||
|
||||
|
||||
|
||||
$resultContext = $next($updatedContext);
|
||||
|
||||
if(!$resultContext->hasResponse() && $originalResponse !== null) {
|
||||
if (! $resultContext->hasResponse()) {
|
||||
return $resultContext->withResponse($originalResponse);
|
||||
}
|
||||
|
||||
return $resultContext;
|
||||
}
|
||||
|
||||
|
||||
/*// Prüfen, ob es sich um einen angereicherten Request handelt
|
||||
if ($request instanceof EnrichedRequest && $request->result) {
|
||||
// Response aus dem Controller-Ergebnis generieren
|
||||
$originalResponse = $this->responder->respond($request->result);
|
||||
|
||||
// Kontext mit der generierten Response aktualisieren
|
||||
$updatedContext = $context->withResponse($originalResponse);
|
||||
|
||||
|
||||
|
||||
$resultContext = $next($updatedContext);
|
||||
|
||||
if(!$resultContext->hasResponse() && $originalResponse !== null) {
|
||||
return $resultContext->withResponse($originalResponse);
|
||||
}
|
||||
|
||||
return $resultContext;
|
||||
}*/
|
||||
|
||||
// Immer die nächste Middleware aufrufen, auch wenn bereits eine Response generiert wurde
|
||||
return $next($context);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user