Update API category display code

This commit is contained in:
DariusIII
2026-08-02 23:58:52 +02:00
parent ed1f4e8fa3
commit e9e23c5027
3 changed files with 52 additions and 3 deletions
+4 -1
View File
@@ -10,6 +10,9 @@ use Illuminate\Http\Response;
final readonly class ApiV1Presenter
{
// JSON_HEX_TAG would turn category separators such as ">" into "\u003E".
private const JSON_ENCODING_OPTIONS = JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
public function __construct(private ApiCapabilitiesService $capabilities) {}
/**
@@ -40,7 +43,7 @@ final readonly class ApiV1Presenter
if ($array === false) {
return showApiError(201);
}
$body = json_encode($array, JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES);
$body = json_encode($array, self::JSON_ENCODING_OPTIONS);
$contentType = 'application/json';
}
+1
View File
@@ -13,6 +13,7 @@ use Illuminate\Support\Carbon;
final class ApiV2Presenter
{
// JSON_HEX_TAG would turn category separators such as ">" into "\u003E".
private const JSON_ENCODING_OPTIONS = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
/** @param array<string, mixed> $data */