$headers =
[ 'content-type' =>
['Content-Type: multipart/form-data; boundary=ABCDEF'
],
];
$body =
[ 'foo[]' => 'bar',
'bar' =>
[ $file,
],
];
$body = self::
normalizeBody($body,
$headers);
$result = '';
while ('' !==
$data =
$body(self::
$CHUNK_SIZE)) { $result .=
$data;
} $expected = <<<'EOF'
--ABCDEF
Content-Disposition: form-data; name="foo[]"
bar
--ABCDEF
Content-Disposition: form-data; name="bar[0]"; filename="test.txt"
Content-Type: text/plain
foobarbaz
--ABCDEF--