Skip to content

Commit

Permalink
Corona: Fetch request ID from TracingInfoParser
Browse files Browse the repository at this point in the history
  • Loading branch information
pprkut committed Feb 19, 2025
1 parent 7a1951c commit 6b2db86
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/Lunr/Corona/Tests/ViewTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace Lunr\Corona\Tests;

use Lunr\Core\Configuration;
use Lunr\Corona\Parsers\TracingInfo\TracingInfoValue;
use Lunr\Corona\Request;
use Lunr\Corona\Response;
use Lunr\Corona\View;
Expand Down Expand Up @@ -85,9 +86,9 @@ public function setUp(): void
if (!headers_sent())
{
$this->request->expects($this->once())
->method('__get')
->with('id')
->willReturn('962161b27a0141f384c63834ad001adf');
->method('get')
->with(TracingInfoValue::TraceID)
->willReturn('962161b27a0141f384c63834ad001adf');
}

$this->class = $this->getMockBuilder('Lunr\Corona\View')
Expand Down
3 changes: 2 additions & 1 deletion src/Lunr/Corona/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace Lunr\Corona;

use Lunr\Core\Configuration;
use Lunr\Corona\Parsers\TracingInfo\TracingInfoValue;
use Throwable;

/**
Expand Down Expand Up @@ -52,7 +53,7 @@ public function __construct($request, $response, $configuration)

if (!headers_sent())
{
header('X-Request-ID: ' . $request->id);
header('X-Request-ID: ' . $request->get(TracingInfoValue::TraceID));
}
}

Expand Down

0 comments on commit 6b2db86

Please sign in to comment.