How can I set custom boundary to the multipart POST request? Following request options configuration doesn\'t work.
\'headers\' => [\'Content-Type\' => \'m
Guzzle uses psr7 to combine multipart form fields into request body. The most correct way to deal with custom boundary would be using GuzzleHttp\Psr7\MultipartStream.
$boundary = 'my_custom_boundary';
$multipart_form = [
[
'name' => 'upload_id',
'contents' => $upload_id,
],
[
'name' => '_uuid',
'contents' => $uuid,
],
...
];
$params = [
'headers' => [
'Connection' => 'close',
'Content-Type' => 'multipart/form-data; boundary='.$boundary,
],
'body' => new GuzzleHttp\Psr7\MultipartStream($multipart_form, $boundary), // here is all the magic
];
$res = $this->client->request($method, $url, $params);