src/Composer/Util/StreamContextFactory.php
private static function fixHttpHeaderField($header)
    {
        if (!is_array($header)) {
            $header = explode("\r\n", $header);
        }
        uasort($header, function ($el) {
            return stripos($el, 'content-type') === 0 ? 1 : -1;
        });

        return $header;
    }
private static function fixHttpHeaderField($header)
    {
        if (!is_array($header)) {
            $header = explode("\r\n", $header);
        }
        uasort($header, function ($el) {
            return stripos($el, 'content-type') === 0 ? 1 : -1;
        });

        return $header;
    }
A bug in PHP prevents the headers from correctly being sent when a content-type header is present and
NOT at the end of the array

This method fixes the array by moving the content-type header to the end

@link https://bugs.php.net/bug.php?id=61548
@param string|array $header
@return array