From 5b11e6b2124a1b10a555edeebec8258191d8541f Mon Sep 17 00:00:00 2001 From: Jakub Onderka Date: Sun, 24 Mar 2024 18:46:02 +0100 Subject: [PATCH] chg: [internal] Log content type when JSON could not be parsed --- app/Lib/Tools/HttpSocketExtended.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Lib/Tools/HttpSocketExtended.php b/app/Lib/Tools/HttpSocketExtended.php index cfe097c2861..051c0ae60c4 100644 --- a/app/Lib/Tools/HttpSocketExtended.php +++ b/app/Lib/Tools/HttpSocketExtended.php @@ -121,7 +121,8 @@ public function json() try { return JsonTool::decode($this->body); } catch (Exception $e) { - throw new HttpSocketJsonException('Could not parse response as JSON.', $this, $e); + $contentType = $this->getHeader('content-type'); + throw new HttpSocketJsonException("Could not parse HTTP response as JSON. Received Content-Type $contentType.", $this, $e); } } }