From af4e0a7a5054d6ef1ca725ed31c2181232968035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20=C5=BB=C3=B3=C5=82tak?= Date: Tue, 17 Sep 2024 18:04:29 +0200 Subject: [PATCH] EntityController.php::redirect(): make it work if no Accept header is specified --- controller/EntityController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/controller/EntityController.php b/controller/EntityController.php index ffdfdeb4..3db582f7 100644 --- a/controller/EntityController.php +++ b/controller/EntityController.php @@ -70,7 +70,11 @@ public function redirect($request) { // optional query parameter for forcing a specific format $requestedFormat = $request->getQueryParam('format'); - $targetFormat = $this->negotiateFormat($supportedFormats, $request->getServerConstant('HTTP_ACCEPT'), $requestedFormat); + $accept = $request->getServerConstant('HTTP_ACCEPT'); + if (empty($accept)) { + $accept = '*/*'; + } + $targetFormat = $this->negotiateFormat($supportedFormats, $accept, $requestedFormat); if (in_array($targetFormat, $restFormats)) { $this->redirectREST($request->getVocab(), $request->getUri(), $targetFormat);