Amp\Artax\FormBody::getHeaders PHP Method

getHeaders() public method

AggregateBody::getHeaders() implementations always return a Promise instance to allow for future resolution of non-blocking operations (e.g. when using filesystem stats to generate content-length headers).
public getHeaders ( ) : Amp\Promise
return Amp\Promise
    public function getHeaders()
    {
        $promisor = new Deferred();
        $length = $this->getLength();
        $length->when(function ($error, $result) use($promisor) {
            if ($error) {
                $promisor->fail($error);
            } else {
                $type = $this->determineContentType();
                $promisor->succeed(['Content-Type' => $type, 'Content-Length' => $result]);
            }
        });
        return $promisor->promise();
    }