Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Data for PATCH requests in net\http\Service should be encoded in the request body. Fixes #647. #648

Merged
merged 1 commit into from Sep 18, 2012
Jump to file or symbol
Failed to load files and symbols.
+3 −2
Split
View
@@ -222,7 +222,7 @@ public function send($method, $path = null, $data = array(), array $options = ar
* @param string $data
* @param string $options
* @return object Returns an instance of `http\Request`, configured with an HTTP method, query
- * string or POST/PUT data, and URL.
+ * string or POST/PUT/PATCH data, and URL.
*/
protected function _request($method, $path, $data, $options) {
$defaults = array('type' => 'form');
@@ -232,7 +232,7 @@ protected function _request($method, $path, $data, $options) {
$request->path = str_replace('//', '/', "{$request->path}{$path}");
$request->method = $method = strtoupper($method);
- $hasBody = in_array($method, array('POST', 'PUT'));
+ $hasBody = in_array($method, array('POST', 'PUT', 'PATCH'));
$hasBody ? $request->type($options['type']) : null;
$hasBody ? $request->body($data) : $request->query = $data;
return $request;
@@ -263,6 +263,7 @@ public function testMagicMethod() {
$result = $http->last->request;
$this->assertEqual('PATCH', $result->method);
$this->assertEqual('lithium\net\http\Response', get_class($response));
+ $this->assertEqual('someData=someValue', $result->body());
}
public function testDigestAuth() {