mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-27 17:31:20 -06: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'));
|
|
}
|
|
}
|