protected function _createRequest($method, $url, $data, $options)
    {
        $headers = isset($options['headers']) ? (array)$options['headers'] : [];
        if (isset($options['type'])) {
            $headers = array_merge($headers, $this->_typeHeaders($options['type']));
        }
        if (is_string($data) && !isset($headers['Content-Type']) && !isset($headers['content-type'])) {
            $headers['Content-Type'] = 'application/x-www-form-urlencoded';
        }

        $request = new Request($url, $method, $headers, $data);
        $cookies = isset($options['cookies']) ? $options['cookies'] : [];
        /** @var \Cake\Http\Client\Request $request */
        $request = $this->_cookies->addToRequest($request, $cookies);
        if (isset($options['auth'])) {
            $request = $this->_addAuthentication($request, $options);
        }
        if (isset($options['proxy'])) {
            $request = $this->_addProxy($request, $options);
        }

        return $request;
    }
protected function _createRequest($method, $url, $data, $options)
    {
        $headers = isset($options['headers']) ? (array)$options['headers'] : [];
        if (isset($options['type'])) {
            $headers = array_merge($headers, $this->_typeHeaders($options['type']));
        }
        if (is_string($data) && !isset($headers['Content-Type']) && !isset($headers['content-type'])) {
            $headers['Content-Type'] = 'application/x-www-form-urlencoded';
        }

        $request = new Request($url, $method, $headers, $data);
        $cookies = isset($options['cookies']) ? $options['cookies'] : [];
        /** @var \Cake\Http\Client\Request $request */
        $request = $this->_cookies->addToRequest($request, $cookies);
        if (isset($options['auth'])) {
            $request = $this->_addAuthentication($request, $options);
        }
        if (isset($options['proxy'])) {
            $request = $this->_addProxy($request, $options);
        }

        return $request;
    }
protected function _createRequest ( $ method , $ url , $ data , $ options ) { $ headers = isset ( $ options [ 'headers' ] ) ? ( array ) $ options [ 'headers' ] : [ ] ; if ( isset ( $ options [ 'type' ] ) ) { $ headers = array_merge ( $ headers , $ this -> _typeHeaders ( $ options [ 'type' ] ) ) ; } if ( is_string ( $ data ) && ! isset ( $ headers [ 'Content-Type' ] ) && ! isset ( $ headers [ 'content-type' ] ) ) { $ headers [ 'Content-Type' ] = 'application/x-www-form-urlencoded' ; } $ request = new Request ( $ url , $ method , $ headers , $ data ) ; $ cookies = isset ( $ options [ 'cookies' ] ) ? $ options [ 'cookies' ] : [ ] ; /** @var \Cake\Http\Client\Request $request */ $ request = $ this -> _cookies -> addToRequest ( $ request , $ cookies ) ; if ( isset ( $ options [ 'auth' ] ) ) { $ request = $ this -> _addAuthentication ( $ request , $ options ) ; } if ( isset ( $ options [ 'proxy' ] ) ) { $ request = $ this -> _addProxy ( $ request , $ options ) ; } return $ request ; }
Creates a new request object based on the parameters.

@param string $method HTTP method name.
@param string $url The url including query string.
@param mixed $data The request body.
@param array $options The options to use. Contains auth, proxy, etc.
@return \Cake\Http\Client\Request
Creates a new request object based on the parameters .