diff --git a/src/Utility/Httpie.php b/src/Utility/Httpie.php index 3549e5558..93a7e7599 100644 --- a/src/Utility/Httpie.php +++ b/src/Utility/Httpie.php @@ -71,6 +71,14 @@ public static function patch(string $url): Httpie return $http; } + public function delete(string $url): Httpie + { + $http = new self; + $http->method = 'DELETE'; + $http->url = $url; + return $http; + } + public function query(array $params): Httpie { $http = clone $this; @@ -137,6 +145,9 @@ public function nothrow(bool $on = true): Httpie public function send(?array &$info = null): string { + if($this->url === '') { + throw new \RuntimeException('URL must not be empty to Httpie::send()'); + } $ch = curl_init($this->url); curl_setopt($ch, CURLOPT_USERAGENT, 'Deployer ' . DEPLOYER_VERSION); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $this->method);