YurunHttp
YurunHttp copied to clipboard
Curl Handler并发发送文件,未设置正确的Content-Type
bug地址:
https://github.com/Yurunsoft/YurunHttp/blob/df62abcb81166f4fa1a1eca426cd0b6792b0edce/src/YurunHttp/Handler/Curl.php#L738 当前代码:
$this->buildCurlHandlerBase($request, $curlHandler, $recvHeaders[$k], $saveFileFps[$k]);
$files = $request->getUploadedFiles();
$body = (string) $request->getBody();
if (!empty($files))
{
$body = FormDataBuilder::build($body, $files, $boundary);
$request = $request->withHeader('Content-Type', MediaType::MULTIPART_FORM_DATA . '; boundary=' . $boundary);
}
期望代码:
$files = $request->getUploadedFiles();
$body = (string) $request->getBody();
if (!empty($files))
{
$body = FormDataBuilder::build($body, $files, $boundary);
$request = $request->withHeader('Content-Type', MediaType::MULTIPART_FORM_DATA . '; boundary=' . $boundary);
}
$this->buildCurlHandlerBase($request, $curlHandler, $recvHeaders[$k], $saveFileFps[$k]);