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();
}