mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 23:33:13 +08:00
Replace request-id middleware dependency with userland code
This commit is contained in:
30
module/Rest/test-api/Middleware/RequestIdTest.php
Normal file
30
module/Rest/test-api/Middleware/RequestIdTest.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ShlinkioApiTest\Shlink\Rest\Middleware;
|
||||
|
||||
use GuzzleHttp\RequestOptions;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Shlinkio\Shlink\TestUtils\ApiTest\ApiTestCase;
|
||||
|
||||
class RequestIdTest extends ApiTestCase
|
||||
{
|
||||
#[Test]
|
||||
public function generatesRequestId(): void
|
||||
{
|
||||
$response = $this->callApi('GET', '/health');
|
||||
self::assertTrue($response->hasHeader('X-Request-Id'));
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function keepsProvidedRequestId(): void
|
||||
{
|
||||
$response = $this->callApi('GET', '/health', [
|
||||
RequestOptions::HEADERS => [
|
||||
'X-Request-Id' => 'foobar',
|
||||
],
|
||||
]);
|
||||
self::assertEquals('foobar', $response->hasHeader('X-Request-Id'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user