Permalink
Browse files

Data for PATCH requests in net\http\Service should be encoded in the …

…request body. Fixes #647.
  • Loading branch information...
1 parent d42184c commit 2576ec81a97605a5232df6b0216ad31291430d14 @ppadron ppadron committed Sep 18, 2012
Showing with 3 additions and 2 deletions.
  1. +2 −2 net/http/Service.php
  2. +1 −0 tests/cases/net/http/ServiceTest.php
@@ -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() {

0 comments on commit 2576ec8

Please sign in to comment.