-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
lbajsarowicz
wants to merge
9
commits into
magento:2.4-develop
Choose a base branch
from
lbajsarowicz:swiftotter-SOP-348-curl-client
base: 2.4-develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+116
−26
Open
Changes from all commits
Commits
Show all changes
9 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 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 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 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 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,15 +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::delete() when you want to use delete method | ||
*/ | ||
class Curl extends CurlLibrary | ||
{ | ||
/** | ||
|
@@ -19,12 +22,13 @@ class Curl extends CurlLibrary | |
* This feature was added base on Community Pull Request https://github.com/magento/magento2/pull/8373 | ||
* | ||
* @param string $uri | ||
* @param array|string $params | ||
* @return void | ||
* | ||
* @see \Magento\Framework\HTTP\Client#post($uri, $params) | ||
*/ | ||
public function delete($uri) | ||
public function delete(string $uri, array|string $params = []) | ||
{ | ||
$this->makeRequest("DELETE", $uri); | ||
$this->makeRequest("DELETE", $uri, $params); | ||
} | ||
} |
This file contains 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 | ||
*/ | ||
|
@@ -246,6 +244,89 @@ 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 | ||
* @param array|string $params | ||
* @return void | ||
*/ | ||
public function delete(string $uri, array|string $params = []) | ||
{ | ||
$this->makeRequest("DELETE", $uri, $params); | ||
} | ||
|
||
/** | ||
* 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 | ||
* @param array|string $params | ||
* @return void | ||
*/ | ||
public function options(string $uri, array|string $params = []) | ||
{ | ||
$this->makeRequest("OPTIONS", $uri, $params); | ||
} | ||
|
||
/** | ||
* Make HEAD request | ||
* | ||
* @param string $uri | ||
* @param array|string $params | ||
* @return void | ||
*/ | ||
public function head(string $uri, array|string $params = []) | ||
{ | ||
$this->makeRequest("HEAD", $uri, $params); | ||
} | ||
|
||
/** | ||
* Make TRACE request | ||
* | ||
* @param string $uri | ||
* @return void | ||
*/ | ||
public function trace(string $uri) | ||
{ | ||
$this->makeRequest("TRACE", $uri); | ||
} | ||
|
||
/** | ||
* Make CONNECT request | ||
* | ||
* @param string $uri | ||
* @param array|string $params | ||
* @return void | ||
*/ | ||
public function connect(string $uri, array|string $params = []) | ||
{ | ||
$this->makeRequest("CONNECT", $uri, $params); | ||
} | ||
|
||
/** | ||
* 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