From 1e3f7cfcba886065f4649053825bebd63fd3a481 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 12 Oct 2021 17:32:59 +0200 Subject: [PATCH] Fix handling of json error responses --- src/Composer/Util/Http/CurlDownloader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Util/Http/CurlDownloader.php b/src/Composer/Util/Http/CurlDownloader.php index cb1f6daea..c32d5bbe3 100644 --- a/src/Composer/Util/Http/CurlDownloader.php +++ b/src/Composer/Util/Http/CurlDownloader.php @@ -566,7 +566,7 @@ class CurlDownloader } $details = ''; - if ($response->getHeader('content-type') === 'application/json') { + if (in_array(strtolower($response->getHeader('content-type')), array('application/json', 'application/json; charset=utf-8'), true)) { $details = ':'.PHP_EOL.substr($response->getBody(), 0, 200).(strlen($response->getBody()) > 200 ? '...' : ''); }