mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-28 09:03:07 +03:00
30 lines
758 B
PHP
30 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'));
|
|
}
|
|
}
|