src/Generics/Client/HttpClientTrait.php
private function prepareRequest($requestType): MemoryStream
    {
        $ms = new MemoryStream();
        
        // First send the request type
        $ms->interpolate("{rqtype} {path}{query} {proto}\r\n", array(
            'rqtype' => $requestType,
            'path' => $this->path,
            'proto' => $this->protocol,
            'query' => (strlen($this->queryString) ? '?' . $this->queryString : '')
        ));
        
        // Add the host part
        $ms->interpolate("Host: {host}\r\n", array(
            'host' => $this->getEndpoint()
                ->getAddress()
        ));
        
        $this->adjustHeaders($requestType);
        
        // Add all existing headers
        foreach ($this->getHeaders() as $headerName => $headerValue) {
            if (isset($headerValue) && strlen($headerValue) > 0) {
                $ms->interpolate("{headerName}: {headerValue}\r\n", array(
                    'headerName' => $headerName,
                    'headerValue' => $headerValue
                ));
            }
        }
        
        $ms->write("\r\n");
        
        return $ms;
    }
private function prepareRequest($requestType): MemoryStream
    {
        $ms = new MemoryStream();
        
        // First send the request type
        $ms->interpolate("{rqtype} {path}{query} {proto}\r\n", array(
            'rqtype' => $requestType,
            'path' => $this->path,
            'proto' => $this->protocol,
            'query' => (strlen($this->queryString) ? '?' . $this->queryString : '')
        ));
        
        // Add the host part
        $ms->interpolate("Host: {host}\r\n", array(
            'host' => $this->getEndpoint()
                ->getAddress()
        ));
        
        $this->adjustHeaders($requestType);
        
        // Add all existing headers
        foreach ($this->getHeaders() as $headerName => $headerValue) {
            if (isset($headerValue) && strlen($headerValue) > 0) {
                $ms->interpolate("{headerName}: {headerValue}\r\n", array(
                    'headerName' => $headerName,
                    'headerValue' => $headerValue
                ));
            }
        }
        
        $ms->write("\r\n");
        
        return $ms;
    }
Prepare the request buffer

@param string $requestType
@return \Generics\Streams\MemoryStream
@throws \Generics\Streams\StreamException