Amp\Artax\FormBody class FormBody implements Amp\Artax\RequestBody

Summary

Properties

Methods

Properties

Methods

__construct — public function __construct(string $boundary = null)
No documentation.
Type Parameter Description Default Value
string $boundary An optional multipart boundary string null
addField — public function addField(string $name, string $value, string $contentType = 'text/plain')

Add a data field to the form entity body.

Type Parameter Description Default Value
string $name No documentation. none
string $value No documentation. none
string $contentType No documentation. 'text/plain'
addFields — public function addFields(array $data, string $contentType = 'text/plain')

Add each element of a associative array as a data field to the form entity body.

Type Parameter Description Default Value
array $data No documentation. none
string $contentType No documentation. 'text/plain'
addFile — public function addFile(string $name, string $filePath, string $contentType = 'application/octet-stream')

Add a file field to the form entity body.

Type Parameter Description Default Value
string $name No documentation. none
string $filePath No documentation. none
string $contentType No documentation. 'application/octet-stream'
addFiles — public function addFiles(array $data, string $contentType = 'application/octet-stream')

Add each element of a associative array as a file field to the form entity body.

Type Parameter Description Default Value
array $data No documentation. none
string $contentType No documentation. 'application/octet-stream'
createBodyStream — public function createBodyStream(): Amp\ByteStream\InputStream

Create the HTTP message body to be sent.

Further calls MUST return a new stream to make it possible to resend bodies on redirects.

getHeaders — public function getHeaders(): Amp\Promise

Retrieve a key-value array of headers to add to the outbound request.

The resolved promise value must be a key-value array mapping header fields to values.

getBodyLength — public function getBodyLength(): Amp\Promise

Retrieve the HTTP message body length. If not available, return -1.