Extends
lithium\core\Object
Instantiates a request object (usually an instance of `http\Request`) and tests its
properties based on the request type and data to be sent.
Parameters
- string $method The HTTP method of the request, i.e. `'GET'`, `'HEAD'`, `'OPTIONS'`, etc. Can be passed in upper- or lower-case.
- string $path The
- string $data
- string $options
Returns
object Returns an instance of `http\Request`, configured with an HTTP method, query string or POST/PUT data, and URL.Source
protected function _request($method, $path, $data, $options) {
$defaults = array('type' => 'form');
$options += $defaults + $this->_config;
$request = $this->_instance('request', $options);
$request->path = str_replace('//', '/', "{$request->path}{$path}");
$request->method = $method = strtoupper($method);
$hasBody = in_array($method, array('POST', 'PUT'));
$hasBody ? $request->body($data) : $request->query = $data;
$hasBody ? $request->type($options['type']) : null;
return $request;
}