diff options
author | Robin Appelman <robin@icewind.nl> | 2022-01-31 17:01:58 +0300 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2022-02-01 16:24:01 +0300 |
commit | c7129878780787151eae9edeb680b11c45535a34 (patch) | |
tree | 09e119b47dde3f04790103a35b0b017fbab16efa /tests | |
parent | d635d58d19d5ab65c0be754fc32fce99672c249f (diff) |
send request id in response header
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/AppFramework/Controller/ControllerTest.php | 5 | ||||
-rw-r--r-- | tests/lib/AppFramework/Http/DataResponseTest.php | 2 | ||||
-rw-r--r-- | tests/lib/AppFramework/Http/ResponseTest.php | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/tests/lib/AppFramework/Controller/ControllerTest.php b/tests/lib/AppFramework/Controller/ControllerTest.php index d874ec48247..1d72482e75d 100644 --- a/tests/lib/AppFramework/Controller/ControllerTest.php +++ b/tests/lib/AppFramework/Controller/ControllerTest.php @@ -28,6 +28,7 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\JSONResponse; use OCP\IConfig; +use OCP\IRequest; class ChildController extends Controller { public function __construct($appName, $request) { @@ -59,6 +60,7 @@ class ControllerTest extends \Test\TestCase { */ private $controller; private $app; + private $request; protected function setUp(): void { parent::setUp(); @@ -90,6 +92,8 @@ class ControllerTest extends \Test\TestCase { ->willReturn('apptemplate_advanced'); $this->controller = new ChildController($this->app, $request); + $this->overwriteService(IRequest::class, $request); + $this->request = $request; } @@ -114,6 +118,7 @@ class ControllerTest extends \Test\TestCase { 'Content-Type' => 'application/json; charset=utf-8', 'Content-Security-Policy' => "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'", 'Feature-Policy' => "autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone 'none';payment 'none'", + 'X-Request-Id' => $this->request->getId(), 'X-Robots-Tag' => 'none', ]; diff --git a/tests/lib/AppFramework/Http/DataResponseTest.php b/tests/lib/AppFramework/Http/DataResponseTest.php index 889372775d6..f933b3102b7 100644 --- a/tests/lib/AppFramework/Http/DataResponseTest.php +++ b/tests/lib/AppFramework/Http/DataResponseTest.php @@ -25,6 +25,7 @@ namespace Test\AppFramework\Http; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; +use OCP\IRequest; class DataResponseTest extends \Test\TestCase { @@ -68,6 +69,7 @@ class DataResponseTest extends \Test\TestCase { 'Content-Security-Policy' => "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'", 'Feature-Policy' => "autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone 'none';payment 'none'", 'X-Robots-Tag' => 'none', + 'X-Request-Id' => \OC::$server->get(IRequest::class)->getId(), ]; $expectedHeaders = array_merge($expectedHeaders, $headers); diff --git a/tests/lib/AppFramework/Http/ResponseTest.php b/tests/lib/AppFramework/Http/ResponseTest.php index 97a1ee25588..c725e2fb602 100644 --- a/tests/lib/AppFramework/Http/ResponseTest.php +++ b/tests/lib/AppFramework/Http/ResponseTest.php @@ -91,7 +91,7 @@ class ResponseTest extends \Test\TestCase { public function testAddHeaderValueNullDeletesIt() { $this->childResponse->addHeader('hello', 'world'); $this->childResponse->addHeader('hello', null); - $this->assertEquals(4, count($this->childResponse->getHeaders())); + $this->assertEquals(5, count($this->childResponse->getHeaders())); } |