mirror of
https://github.com/shlinkio/shlink.git
synced 2025-01-06 20:07:33 +03:00
31 lines
758 B
PHP
31 lines
758 B
PHP
|
<?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'));
|
||
|
}
|
||
|
}
|