Skip to content

Commit

Permalink
Merge pull request #9639 from JakubOnderka/http-json-content-type
Browse files Browse the repository at this point in the history
chg: [internal] Log content type when JSON could not be parsed
  • Loading branch information
JakubOnderka committed Apr 14, 2024
2 parents 731b969 + 5b11e6b commit 88ab819
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Lib/Tools/HttpSocketExtended.php
Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit 88ab819

Please sign in to comment.