lithium\net\http\Service::delete PHP Method

delete() public method

Send DELETE request.
public delete ( string $path = null, array $data = [], array $options = [] ) : string
$path string
$data array
$options array
return string
    public function delete($path = null, $data = array(), array $options = array())
    {
        $defaults = array('type' => false);
        return $this->send(__FUNCTION__, $path, $data, $options + $defaults);
    }

Usage Example

Beispiel #1
0
 public function testDelete()
 {
     $http = new Service($this->_testConfig);
     $http->delete('posts/1');
     $expected = join("\r\n", array('DELETE /posts/1 HTTP/1.1', 'Host: localhost:80', 'Connection: Close', 'User-Agent: Mozilla/5.0', '', ''));
     $result = (string) $http->last->request;
     $this->assertEqual($expected, $result);
     $expected = join("\r\n", array('HTTP/1.1 200 OK', 'Host: localhost:80', 'Connection: Close', 'User-Agent: Mozilla/5.0', '', ''));
     $result = (string) $http->last->response;
     $this->assertEqual($expected, $result);
 }