} $hasContentLength =
isset($options['normalized_headers'
]['content-length'
]);
$hasBody = '' !==
$options['body'
] || 'POST' ===
$method ||
$hasContentLength;
$options['body'
] = self::
getBodyAsString($options['body'
]);
if ('chunked' ===
substr($options['normalized_headers'
]['transfer-encoding'
][0
] ?? '', \
strlen('Transfer-Encoding: '
))) { unset($options['normalized_headers'
]['transfer-encoding'
]);
$options['headers'
] =
array_merge(...
array_values($options['normalized_headers'
]));
$options['body'
] = self::
dechunk($options['body'
]);
} if ('' ===
$options['body'
] &&
$hasBody && !
$hasContentLength) { $options['headers'
][] = 'Content-Length: 0';
} if ($hasBody && !
isset($options['normalized_headers'
]['content-type'
])) { $options['headers'
][] = 'Content-Type: application/x-www-form-urlencoded';
} if (\
extension_loaded('zlib'
) && !
isset($options['normalized_headers'
]['accept-encoding'
])) { // gzip is the most widely available algo, no need to deal with deflate
$options['headers'
][] = 'Accept-Encoding: gzip';
}