patch() public method

Send PATCH request.
public patch ( string $path = null, array $data = [], array $options = [] ) : string
$path string
$data array
$options array
return string
Esempio n. 1
0
 public function testMagicMethod()
 {
     $http = new Service($this->_testConfig);
     $response = $http->patch('some-path/stuff');
     $expected = "http://localhost:80/some-path/stuff";
     $result = $http->last->request->to('url');
     $this->assertEqual($expected, $result);
     $response = $http->patch('some-path/stuff', array('someData' => 'someValue'), array('return' => 'response'));
     $result = $http->last->request;
     $this->assertEqual('PATCH', $result->method);
     $this->assertEqual('lithium\\net\\http\\Response', get_class($response));
 }
Esempio n. 2
0
 public function testPatchWithJson()
 {
     $http = new Service($this->_testConfig);
     $response = $http->patch('some-path/stuff', array('someData' => 'someValue'), array('return' => 'response', 'type' => 'json'));
     $result = $http->last->request;
     $this->assertEqual('{"someData":"someValue"}', $result->body());
     $this->assertEqual('application/json', $result->headers['Content-Type']);
 }