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 all 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,17 +8,19 @@

namespace Magento\TestFramework\Helper;

use Magento\Framework\HTTP\Client\Curl;

/**
* Helper class to access RabbitMQ server configuration
*/
class Amqp
{
const CONFIG_PATH_HOST = 'queue/amqp/host';
const CONFIG_PATH_USER = 'queue/amqp/user';
const CONFIG_PATH_PASSWORD = 'queue/amqp/password';
const DEFAULT_MANAGEMENT_PROTOCOL = 'http';
const DEFAULT_MANAGEMENT_PORT = '15672';
const DEFAULT_VIRTUALHOST = '/';
public const CONFIG_PATH_HOST = 'queue/amqp/host';
public const CONFIG_PATH_USER = 'queue/amqp/user';
public const CONFIG_PATH_PASSWORD = 'queue/amqp/password';
public const DEFAULT_MANAGEMENT_PROTOCOL = 'http';
public const DEFAULT_MANAGEMENT_PORT = '15672';
public const DEFAULT_VIRTUALHOST = '/';

/**
* @var Curl
Expand Down

This file was deleted.

69 changes: 68 additions & 1 deletion lib/internal/Magento/Framework/HTTP/Client/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
/**
* Class to work with HTTP protocol using curl library
*
* @author Magento Core Team <core@magentocommerce.com>
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
* @api
*/
Expand Down Expand Up @@ -246,6 +245,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