Final Class Yiisoft\Yii\Debug\Api\Debug\Middleware\DebugHeaders
| Inheritance | Yiisoft\ |
|---|---|
| Implements | Psr\ |
Adds debug headers to response. Information from these headers may be used to request information about the current request as it is done in the debug toolbar.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
|
| process() | Yiisoft\ |
Method Details
| public mixed __construct ( \ | ||
| $urlGenerator | \ |
|
| $debugger | ?\ |
|
public function __construct(
private UrlGeneratorInterface $urlGenerator,
private ?Debugger $debugger = null,
) {}
| public \ | ||
| $request | \ |
|
| $handler | \ |
|
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$response = $handler->handle($request);
if ($this->debugger === null || !$this->debugger->isActive()) {
return $response;
}
$link = $this->urlGenerator->generate('debug/api/view', ['id' => $this->debugger->getId()]);
return $response
->withHeader('X-Debug-Id', $this->debugger->getId())
->withHeader('X-Debug-Link', $link);
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.