private function processAggregateBodyHeaders(RequestCycle $cycle, AggregateBody $body) { $promise = $body->getHeaders(); $promise->when(function ($error, $result) use($cycle, $body) { if ($error) { $this->fail($cycle, $error); } else { $cycle->request->setAllHeaders($result); $this->finalizeRequest($cycle); } }); }