lib/Doctrine/CouchDB/HTTP/StreamClient.php
public function request($method, $path, $data = null, $raw = false, array $headers = [])
    {
        $fullPath = $path;
        if ($this->options['path']) {
            $fullPath = '/'.$this->options['path'].$path;
        }

        $this->checkConnection($method, $fullPath, $data, $headers);

        // Read request body.
        $body = '';
        while (!feof($this->httpFilePointer)) {
            $body .= fgets($this->httpFilePointer);
        }

        $headers = $this->getStreamHeaders();

        if (empty($headers['status'])) {
            throw HTTPException::readFailure(
                $this->options['ip'],
                $this->options['port'],
                'Received an empty response or not status code',
                0
            );
        }

        // Create response object from couch db response.
        if ($headers['status'] >= 400) {
            return new ErrorResponse($headers['status'], $headers, $body);
        }

        return new Response($headers['status'], $headers, $body, $raw);
    }
public function request($method, $path, $data = null, $raw = false, array $headers = [])
    {
        $fullPath = $path;
        if ($this->options['path']) {
            $fullPath = '/'.$this->options['path'].$path;
        }

        $this->checkConnection($method, $fullPath, $data, $headers);

        // Read request body.
        $body = '';
        while (!feof($this->httpFilePointer)) {
            $body .= fgets($this->httpFilePointer);
        }

        $headers = $this->getStreamHeaders();

        if (empty($headers['status'])) {
            throw HTTPException::readFailure(
                $this->options['ip'],
                $this->options['port'],
                'Received an empty response or not status code',
                0
            );
        }

        // Create response object from couch db response.
        if ($headers['status'] >= 400) {
            return new ErrorResponse($headers['status'], $headers, $body);
        }

        return new Response($headers['status'], $headers, $body, $raw);
    }
public function request ( $ method , $ path , $ data = null , $ raw = false , array $ headers = [ ] ) { $ fullPath = $ path ; if ( $ this -> options [ 'path' ] ) { $ fullPath = '/' . $ this -> options [ 'path' ] . $ path ; } $ this -> checkConnection ( $ method , $ fullPath , $ data , $ headers ) ; // Read request body. $ body = '' ; while ( ! feof ( $ this -> httpFilePointer ) ) { $ body .= fgets ( $ this -> httpFilePointer ) ; } $ headers = $ this -> getStreamHeaders ( ) ; if ( empty ( $ headers [ 'status' ] ) ) { throw HTTPException :: readFailure ( $ this -> options [ 'ip' ] , $ this -> options [ 'port' ] , 'Received an empty response or not status code' , 0 ) ; } // Create response object from couch db response. if ( $ headers [ 'status' ] >= 400 ) { return new ErrorResponse ( $ headers [ 'status' ] , $ headers , $ body ) ; } return new Response ( $ headers [ 'status' ] , $ headers , $ body , $ raw ) ; }
Perform a request to the server and return the result.

Perform a request to the server and return the result converted into a
Response object. If you do not expect a JSON structure, which
could be converted in such a response object, set the forth parameter to
true, and you get a response object returned, containing the raw body.

@param string $method
@param string $path
@param string $data
@param bool   $raw
@param array  $headers

@throws HTTPException

@return Response
Perform a request to the server and return the result .