mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-04 22:57:20 +00:00
External Libraries: Update the Requests library to version 2.0.0.
This is a major release and contains breaking changes. Most important changes to be aware of for this release: * All code is now namespaced. Though there is a full backward compatibility layer available and the old class names are still supported, using them will generate a deprecation notice (which can be silenced by plugins if they'd need to support multiple WP versions). See the [https://requests.ryanmccue.info/docs/upgrading.html upgrade guide] for more details. * A lot of classes have been marked `final`. This should generally not affect userland code as care has been taken to not apply the `final` keyword to classes which are known to be extended in userland code. * Extensive input validation has been added to Requests. When Requests is used as documented though, this will be unnoticable. * A new `WpOrg\Requests\Requests::has_capabilities()` method has been introduced which can be used to address #37708. * A new `WpOrg\Requests\Response::decode_body()` method has been introduced which may be usable to simplify some of the WP native wrapper code. * Remaining PHP 8.0 compatibility fixed (support for named parameters). * PHP 8.1 compatibility. Release notes: https://github.com/WordPress/Requests/releases/tag/v2.0.0 For a full list of changes in this update, see the Requests GitHub: https://github.com/WordPress/Requests/compare/v1.8.1...v2.0.0 Follow-up to [50842], [51078]. Props jrf, schlessera, datagutten, wojsmol, dd32, dustinrue, soulseekah, costdev, szepeviktor. Fixes #54504. git-svn-id: https://develop.svn.wordpress.org/trunk@52244 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Core wrapper object for a Requests_Response for standardisation.
|
||||
* Core wrapper object for a WpOrg\Requests\Response for standardisation.
|
||||
*
|
||||
* @since 4.6.0
|
||||
*
|
||||
@@ -19,7 +19,7 @@ class WP_HTTP_Requests_Response extends WP_HTTP_Response {
|
||||
* Requests Response object.
|
||||
*
|
||||
* @since 4.6.0
|
||||
* @var Requests_Response
|
||||
* @var \WpOrg\Requests\Response
|
||||
*/
|
||||
protected $response;
|
||||
|
||||
@@ -36,10 +36,10 @@ class WP_HTTP_Requests_Response extends WP_HTTP_Response {
|
||||
*
|
||||
* @since 4.6.0
|
||||
*
|
||||
* @param Requests_Response $response HTTP response.
|
||||
* @param string $filename Optional. File name. Default empty.
|
||||
* @param \WpOrg\Requests\Response $response HTTP response.
|
||||
* @param string $filename Optional. File name. Default empty.
|
||||
*/
|
||||
public function __construct( Requests_Response $response, $filename = '' ) {
|
||||
public function __construct( WpOrg\Requests\Response $response, $filename = '' ) {
|
||||
$this->response = $response;
|
||||
$this->filename = $filename;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ class WP_HTTP_Requests_Response extends WP_HTTP_Response {
|
||||
*
|
||||
* @since 4.6.0
|
||||
*
|
||||
* @return Requests_Response HTTP response.
|
||||
* @return WpOrg\Requests\Response HTTP response.
|
||||
*/
|
||||
public function get_response_object() {
|
||||
return $this->response;
|
||||
@@ -60,11 +60,11 @@ class WP_HTTP_Requests_Response extends WP_HTTP_Response {
|
||||
*
|
||||
* @since 4.6.0
|
||||
*
|
||||
* @return \Requests_Utility_CaseInsensitiveDictionary Map of header name to header value.
|
||||
* @return \WpOrg\Requests\Utility\CaseInsensitiveDictionary Map of header name to header value.
|
||||
*/
|
||||
public function get_headers() {
|
||||
// Ensure headers remain case-insensitive.
|
||||
$converted = new Requests_Utility_CaseInsensitiveDictionary();
|
||||
$converted = new WpOrg\Requests\Utility\CaseInsensitiveDictionary();
|
||||
|
||||
foreach ( $this->response->headers->getAll() as $key => $value ) {
|
||||
if ( count( $value ) === 1 ) {
|
||||
@@ -85,7 +85,7 @@ class WP_HTTP_Requests_Response extends WP_HTTP_Response {
|
||||
* @param array $headers Map of header name to header value.
|
||||
*/
|
||||
public function set_headers( $headers ) {
|
||||
$this->response->headers = new Requests_Response_Headers( $headers );
|
||||
$this->response->headers = new WpOrg\Requests\Response\Headers( $headers );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user