public static function validateCurlPOSTBody(Request $request, $curlHandle = null)
    {
        $readFunction = $request->getCurlOption(CURLOPT_READFUNCTION);
        if (is_null($readFunction)) {
            return;
        }
        
        // Guzzle 4 sometimes sets the post body in CURLOPT_POSTFIELDS even if
        // they have already set CURLOPT_READFUNCTION.
        if ($request->getBody()) {
            return;
        }
        
        $bodySize = $request->getCurlOption(CURLOPT_INFILESIZE);
        Assertion::notEmpty($bodySize, 'To set a CURLOPT_READFUNCTION, CURLOPT_INFILESIZE must be set.');
        $body = call_user_func_array($readFunction, array($curlHandle, fopen('php://memory', 'r'), $bodySize));
        $request->setBody($body);
    }