Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…request body. Fixes #647.
  • Loading branch information...
commit 2576ec81a97605a5232df6b0216ad31291430d14 1 parent d42184c
Pedro Padron ppadron authored
Showing with 3 additions and 2 deletions.
  1. +2 −2 net/http/Service.php
  2. +1 −0  tests/cases/net/http/ServiceTest.php
4 net/http/Service.php
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;
1  tests/cases/net/http/ServiceTest.php
View
@@ -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() {
Please sign in to comment.
Something went wrong with that request. Please try again.