Skip to content

Commit

Permalink
Fixes #3472 (#3473)
Browse files Browse the repository at this point in the history
* Fixes #3472

Add DELETE

* Update Httpie.php

improve error message for empty url on HTTPie
  • Loading branch information
Schrank authored Jan 31, 2023
1 parent 1fb2d6f commit 5c3d4a1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Utility/Httpie.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 5c3d4a1

Please sign in to comment.