Skip to content
This repository
Browse code

Merge pull request #648 from ppadron/dev

Data for PATCH requests in net\http\Service should be encoded in the request body. Fixes #647.
  • Loading branch information...
commit b5e4c87c6a3c2b9667731c2028cb78eeac08ead7 2 parents d42184c + 2576ec8
Nate Abele nateabele authored
4 net/http/Service.php
@@ -222,7 +222,7 @@ public function send($method, $path = null, $data = array(), array $options = ar
222 222 * @param string $data
223 223 * @param string $options
224 224 * @return object Returns an instance of `http\Request`, configured with an HTTP method, query
225   - * string or POST/PUT data, and URL.
  225 + * string or POST/PUT/PATCH data, and URL.
226 226 */
227 227 protected function _request($method, $path, $data, $options) {
228 228 $defaults = array('type' => 'form');
@@ -232,7 +232,7 @@ protected function _request($method, $path, $data, $options) {
232 232 $request->path = str_replace('//', '/', "{$request->path}{$path}");
233 233 $request->method = $method = strtoupper($method);
234 234
235   - $hasBody = in_array($method, array('POST', 'PUT'));
  235 + $hasBody = in_array($method, array('POST', 'PUT', 'PATCH'));
236 236 $hasBody ? $request->type($options['type']) : null;
237 237 $hasBody ? $request->body($data) : $request->query = $data;
238 238 return $request;
1  tests/cases/net/http/ServiceTest.php
@@ -263,6 +263,7 @@ public function testMagicMethod() {
263 263 $result = $http->last->request;
264 264 $this->assertEqual('PATCH', $result->method);
265 265 $this->assertEqual('lithium\net\http\Response', get_class($response));
  266 + $this->assertEqual('someData=someValue', $result->body());
266 267 }
267 268
268 269 public function testDigestAuth() {

0 comments on commit b5e4c87

Please sign in to comment.
Something went wrong with that request. Please try again.