-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Add missing REST methods to Curl Client (SwiftOtter's SOP-348) #39330
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
Closed
lbajsarowicz
wants to merge
10
commits into
magento:2.4-develop
from
lbajsarowicz:swiftotter-SOP-348-curl-client
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
302f9b5
SwiftOtter-SOP-348 Add missing REST methods to Curl Client
lbajsarowicz e3668e8
SwiftOtter-SOP-348 Add missing REST methods: TRACE, HEAD, OPTIONS
lbajsarowicz 064aa04
SwiftOtter-SOP-348 Replace redundant override
lbajsarowicz 0ec2621
SwiftOtter-SOP-348 Resolve issues with Static checks
lbajsarowicz 2da6f81
Merge branch '2.4-develop' into swiftotter-SOP-348-curl-client
engcom-Hotel d16233e
Merge branch '2.4-develop' into swiftotter-SOP-348-curl-client
engcom-Dash 4297a88
39330: Add optional payload support for DELETE, OPTIONS, HEAD, and ad…
engcom-Dash 9f32ea3
39330: apply suggested changes and revert deleted file with deprecate…
engcom-Dash e71d63b
39330: update copyright tag
engcom-Dash 252c027
SwiftOtter-SOP-348 Match CURL Client to RFC-9110 and RFC-5789
lbajsarowicz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
...ts/integration/_files/Magento/TestModuleCatalogSearch/Model/SearchEngineVersionReader.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 6 additions & 18 deletions
24
dev/tests/integration/framework/Magento/TestFramework/Helper/Curl.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,18 @@ | ||
<?php | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is not recommended to delete the existing file, as other third-party extensions might use it. Instead, mark it as Thanks |
||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
* Copyright 2018 Adobe | ||
* All Rights Reserved. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Magento\TestFramework\Helper; | ||
|
||
use Magento\Framework\HTTP\Client\Curl as CurlLibrary; | ||
|
||
/** | ||
* @deprecated All the curl methods are included in \Magento\Framework\HTTP\Client\Curl class. | ||
* @see \Magento\Framework\HTTP\Client\Curl | ||
*/ | ||
class Curl extends CurlLibrary | ||
{ | ||
/** | ||
* Make DELETE request | ||
* | ||
* String type was added to parameter $param in order to support sending JSON or XML requests. | ||
* This feature was added base on Community Pull Request https://github.com/magento/magento2/pull/8373 | ||
* | ||
* @param string $uri | ||
* @return void | ||
* | ||
* @see \Magento\Framework\HTTP\Client#post($uri, $params) | ||
*/ | ||
public function delete($uri) | ||
{ | ||
$this->makeRequest("DELETE", $uri); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
* Copyright 2011 Adobe | ||
* All Rights Reserved. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Magento\Framework\HTTP\Client; | ||
|
||
/** | ||
* Class to work with HTTP protocol using curl library | ||
* | ||
* @author Magento Core Team <[email protected]> | ||
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity) | ||
* @api | ||
*/ | ||
|
@@ -223,6 +221,8 @@ public function removeCookies() | |
* | ||
* @param string $uri uri relative to host, ex. "/index.php" | ||
* @return void | ||
* | ||
* @url https://www.rfc-editor.org/rfc/rfc9110.html#section-9.3.1 | ||
*/ | ||
public function get($uri) | ||
{ | ||
|
@@ -239,13 +239,109 @@ public function get($uri) | |
* @param array|string $params | ||
* @return void | ||
* | ||
* @see \Magento\Framework\HTTP\Client#post($uri, $params) | ||
* @see \Magento\Framework\HTTP\Client::post($uri, $params) | ||
* @url https://www.rfc-editor.org/rfc/rfc9110.html#section-9.3.3 | ||
*/ | ||
public function post($uri, $params) | ||
{ | ||
$this->makeRequest("POST", $uri, $params); | ||
} | ||
|
||
/** | ||
* Make PUT request | ||
* | ||
* @param string $uri | ||
* @param array|string $params | ||
* @return void | ||
* | ||
* @url https://www.rfc-editor.org/rfc/rfc9110.html#section-9.3.4 | ||
*/ | ||
public function put(string $uri, string|array $params): void | ||
{ | ||
$this->makeRequest("PUT", $uri, $params); | ||
} | ||
|
||
/** | ||
* Make DELETE request | ||
* | ||
* @param string $uri | ||
* @param array|string $params | ||
* @return void | ||
* | ||
* @url https://www.rfc-editor.org/rfc/rfc9110.html#section-9.3.5 | ||
*/ | ||
public function delete(string $uri, array|string $params = []): void | ||
{ | ||
$this->makeRequest("DELETE", $uri, $params); | ||
} | ||
|
||
/** | ||
* Make PATCH request | ||
* | ||
* @param string $uri | ||
* @param array|string $params | ||
* @return void | ||
* | ||
* @url https://www.rfc-editor.org/info/rfc5789 | ||
*/ | ||
public function patch(string $uri, array|string $params): void | ||
{ | ||
$this->makeRequest("PATCH", $uri, $params); | ||
} | ||
|
||
/** | ||
* Make OPTIONS request | ||
* | ||
* @param string $uri | ||
* @param array|string $params | ||
* @return void | ||
* | ||
* @url https://www.rfc-editor.org/rfc/rfc9110.html#section-9.3.7 | ||
*/ | ||
public function options(string $uri, array|string $params = []): void | ||
{ | ||
$this->makeRequest("OPTIONS", $uri, $params); | ||
} | ||
|
||
/** | ||
* Make HEAD request | ||
* | ||
* @param string $uri | ||
* @return void | ||
* | ||
* @url https://www.rfc-editor.org/rfc/rfc9110.html#section-9.3.2 | ||
*/ | ||
public function head(string $uri): void | ||
{ | ||
$this->makeRequest("HEAD", $uri); | ||
} | ||
|
||
/** | ||
* Make TRACE request | ||
* | ||
* @param string $uri | ||
* @return void | ||
* | ||
* @url https://www.rfc-editor.org/rfc/rfc9110.html#section-9.3.8 | ||
*/ | ||
public function trace(string $uri): void | ||
{ | ||
$this->makeRequest("TRACE", $uri); | ||
} | ||
|
||
/** | ||
* Make CONNECT request | ||
* | ||
* @param string $uri | ||
* @return void | ||
* | ||
* @url https://www.rfc-editor.org/rfc/rfc9110.html#section-9.3.6 | ||
*/ | ||
public function connect(string $uri): void | ||
{ | ||
$this->makeRequest("CONNECT", $uri); | ||
} | ||
|
||
/** | ||
* Get response headers | ||
* | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In line no. 53:
I suggest you add the parameter
$curl
asnull
and useObjectManager
to initialize it. Please refer to the$this->deploymentConfig