Make WordPress Core

Ticket #52424: 52424.diff

File 52424.diff, 1.8 KB (added by mihdan, 4 years ago)
  • src/wp-includes/class-http.php

    diff --git a/src/wp-includes/class-http.php b/src/wp-includes/class-http.php
    index 6a69b2462d..5e8d66d615 100644
    a b class WP_Http { 
    608608                return $this->request( $url, $parsed_args );
    609609        }
    610610
     611        /**
     612         * Uses the PUT HTTP method.
     613         *
     614         * Used for sending data that is expected to be in the body.
     615         *
     616         * @since 5.7
     617         *
     618         * @param string       $url  The request URL.
     619         * @param string|array $args Optional. Override the defaults.
     620         * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'.
     621         *                        A WP_Error instance upon error.
     622         */
     623        public function put( $url, $args = array() ) {
     624                $defaults    = array( 'method' => 'PUT' );
     625                $parsed_args = wp_parse_args( $args, $defaults );
     626                return $this->request( $url, $parsed_args );
     627        }
     628
    611629        /**
    612630         * Uses the GET HTTP method.
    613631         *
  • src/wp-includes/http.php

    diff --git a/src/wp-includes/http.php b/src/wp-includes/http.php
    index fba9dd3bba..53c162b2a7 100644
    a b function wp_remote_post( $url, $args = array() ) { 
    179179        return $http->post( $url, $args );
    180180}
    181181
     182/**
     183 * Performs an HTTP request using the PUT method and returns its response.
     184 *
     185 * @since 5.7
     186 *
     187 * @see wp_remote_request() For more information on the response array format.
     188 * @see WP_Http::request() For default arguments information.
     189 *
     190 * @param string $url  URL to retrieve.
     191 * @param array  $args Optional. Request arguments. Default empty array.
     192 * @return array|WP_Error The response or WP_Error on failure.
     193 */
     194function wp_remote_put( $url, $args = array() ) {
     195        $http = _wp_http_get_object();
     196        return $http->put( $url, $args );
     197}
     198
    182199/**
    183200 * Performs an HTTP request using the HEAD method and returns its response.
    184201 *