Amp\Artax\Client::writeBody PHP Method

writeBody() private method

private writeBody ( RequestCycle $cycle, $body )
$cycle RequestCycle
    private function writeBody(RequestCycle $cycle, $body)
    {
        try {
            $writer = $this->writerFactory->make($body);
            $writePromise = $writer->write($cycle->socket, $body);
            $writePromise->watch(function ($update) use($cycle) {
                $cycle->futureResponse->update([Notify::SOCK_DATA_OUT, $update]);
                if ($cycle->options[self::OP_VERBOSITY] & self::VERBOSE_SEND) {
                    echo $update;
                }
            });
            $writePromise->when(function ($error, $result) use($cycle) {
                if ($error) {
                    $this->fail($cycle, $error);
                } else {
                    $cycle->futureResponse->update([Notify::REQUEST_SENT, $cycle->request]);
                }
            });
        } catch (\Exception $e) {
            $this->fail($cycle, $e);
        }
    }