private function prepare(RequestInterface $request)
    {
        $this->reset($this->handler);
        $this->setUrl($request);
        $this->options[CURLOPT_CUSTOMREQUEST] = $request->getMethod();
        $this->setHeaders($request);
        $this->options[CURLOPT_POSTFIELDS] = (string) $request->getBody();

        if ($this->auth instanceof HttpClientAuthentication) {
            $this->options[CURLOPT_USERPWD] = "{$this->auth->username()}:{$this->auth->password()}";
            $this->options[CURLOPT_HTTPAUTH] = $this->auth->type();
        }

        curl_setopt_array($this->handler, $this->options);
    }