Use PSR-7 responses in CoreRewriteTestAction
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 6 Aug 2021 13:51:37 +0000 (15:51 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 11 Aug 2021 14:29:53 +0000 (16:29 +0200)
wcfsetup/install/files/lib/action/CoreRewriteTestAction.class.php

index 5308d7ef0970d3e28c37d822b9135b3e40c93909..c29ec20a2121dad8a4b4a147a67b9ca4989bce49 100644 (file)
@@ -2,8 +2,8 @@
 
 namespace wcf\action;
 
+use Laminas\Diactoros\Response\JsonResponse;
 use wcf\system\exception\IllegalLinkException;
-use wcf\util\JSON;
 
 /**
  * Internal action used to run a test for url rewriting.
@@ -39,10 +39,14 @@ class CoreRewriteTestAction extends AbstractAction
     {
         parent::execute();
 
-        \header('Access-Control-Allow-Origin: *');
-        \header('Content-type: application/json; charset=UTF-8');
-        echo JSON::encode(['core_rewrite_test' => 'passed']);
-
-        exit;
+        return new JsonResponse(
+            [
+                'core_rewrite_test' => 'passed',
+            ],
+            200,
+            [
+                'access-control-allow-origin' => '*',
+            ]
+        );
     }
 }