Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing REST methods to Curl Client (SwiftOtter's SOP-348) #39330

Open
wants to merge 4 commits into
base: 2.4-develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\TestFramework\Helper\Bootstrap;
use Magento\TestFramework\Helper\Curl;
use Magento\Framework\HTTP\Client\Curl;

/**
* Retrieve search engine version by curl request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

namespace Magento\TestFramework\Helper;

use Magento\Framework\HTTP\Client\Curl;

/**
* Helper class to access RabbitMQ server configuration
*/
Expand Down

This file was deleted.

68 changes: 68 additions & 0 deletions lib/internal/Magento/Framework/HTTP/Client/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,74 @@ public function post($uri, $params)
$this->makeRequest("POST", $uri, $params);
}

/**
* Make PUT request
*
* @param string $uri
* @param array|string $params
* @return void
*/
public function put($uri, $params)
{
$this->makeRequest("PUT", $uri, $params);
}

/**
* Make DELETE request
*
* @param string $uri
* @return void
*/
public function delete($uri)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to HTTP documentation, DELETE request can include optional payload.

{
$this->makeRequest("DELETE", $uri);
}

/**
* Make PATCH request
*
* @param string $uri
* @param array|string $params
* @return void
*/
public function patch($uri, $params)
{
$this->makeRequest("PATCH", $uri, $params);
}

/**
* Make OPTIONS request
*
* @param string $uri
* @return void
*/
public function options($uri)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to HTTP documentation, OPTIONS request can include optional payload.

{
$this->makeRequest("OPTIONS", $uri);
}

/**
* Make HEAD request
*
* @param string $uri
* @return void
*/
public function head($uri)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to HTTP documentation, HEAD request can include optional payload.

{
$this->makeRequest("HEAD", $uri);
}

/**
* Make TRACE request
*
* @param string $uri
* @return void
*/
public function trace($uri)
{
$this->makeRequest("TRACE", $uri);
}

/**
* Get response headers
*
Expand Down