Merge pull request #9639 from JakubOnderka/http-json-content-type

chg: [internal] Log content type when JSON could not be parsed
pull/9685/head
Jakub Onderka 2024-04-14 15:41:11 +02:00 committed by GitHub
commit 88ab8196da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -121,7 +121,8 @@ class HttpSocketResponseExtended extends HttpSocketResponse
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);
}
}
}