protected function getRequestBody()
    {
        if (is_array($this->data)) {
            $this->data = http_build_query($this->data);
        }

        $this->prepareHeaders();

        $path = isset($this->uri['path']) ? $this->uri['path'] : '/';

        if (isset($this->uri['query'])) {
            $path .= "?{$this->uri['query']}";
        }

        $body = "{$this->method} $path HTTP/1.0\r\n";

        foreach ($this->headers as $name => $value) {
            $body .= "$name: " . trim($value) . "\r\n";
        }

        $body .= "\r\n{$this->data}";
        return $body;
    }