Make WordPress Core

Ticket #54225: 54225.patch

File 54225.patch, 86.3 KB (added by mhkuu, 4 years ago)
  • src/wp-admin/includes/ajax-actions.php

    diff --git src/wp-admin/includes/ajax-actions.php src/wp-admin/includes/ajax-actions.php
    index 9d8752caea..d44fd05c4c 100644
    function wp_ajax_upload_attachment() { 
    25322532        check_ajax_referer( 'media-form' );
    25332533        /*
    25342534         * This function does not use wp_send_json_success() / wp_send_json_error()
    2535          * as the html4 Plupload handler requires a text/html content-type for older IE.
     2535         * as the html4 Plupload handler requires a text/html Content-Type for older IE.
    25362536         * See https://core.trac.wordpress.org/ticket/31037
    25372537         */
    25382538
  • src/wp-admin/includes/file.php

    diff --git src/wp-admin/includes/file.php src/wp-admin/includes/file.php
    index e8fb7a6951..b82d128b0d 100644
    function download_url( $url, $timeout = 300, $signature_verification = false ) { 
    11841184                return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ), $data );
    11851185        }
    11861186
    1187         $content_disposition = wp_remote_retrieve_header( $response, 'content-disposition' );
     1187        $content_disposition = wp_remote_retrieve_header( $response, 'Content-Disposition' );
    11881188
    11891189        if ( $content_disposition ) {
    11901190                $content_disposition = strtolower( $content_disposition );
    function download_url( $url, $timeout = 300, $signature_verification = false ) { 
    12111211                }
    12121212        }
    12131213
    1214         $content_md5 = wp_remote_retrieve_header( $response, 'content-md5' );
     1214        $content_md5 = wp_remote_retrieve_header( $response, 'Content-MD5' );
    12151215
    12161216        if ( $content_md5 ) {
    12171217                $md5_check = verify_file_md5( $tmpfname, $content_md5 );
    function download_url( $url, $timeout = 300, $signature_verification = false ) { 
    12381238
    12391239        // Perform signature valiation if supported.
    12401240        if ( $signature_verification ) {
    1241                 $signature = wp_remote_retrieve_header( $response, 'x-content-signature' );
     1241                $signature = wp_remote_retrieve_header( $response, 'X-Content-Signature' );
    12421242
    12431243                if ( ! $signature ) {
    12441244                        // Retrieve signatures from a file if the header wasn't included.
  • src/wp-admin/includes/upgrade.php

    diff --git src/wp-admin/includes/upgrade.php src/wp-admin/includes/upgrade.php
    index 5030483769..923455d82a 100644
    function wp_install_maybe_enable_pretty_permalinks() { 
    529529                 * can block head requests.
    530530                 */
    531531                $response          = wp_remote_get( $test_url, array( 'timeout' => 5 ) );
    532                 $x_pingback_header = wp_remote_retrieve_header( $response, 'x-pingback' );
     532                $x_pingback_header = wp_remote_retrieve_header( $response, 'X-Pingback' );
    533533                $pretty_permalinks = $x_pingback_header && get_bloginfo( 'pingback_url' ) === $x_pingback_header;
    534534
    535535                if ( $pretty_permalinks ) {
  • src/wp-includes/Requests/Transport/fsockopen.php

    diff --git src/wp-includes/Requests/Transport/fsockopen.php src/wp-includes/Requests/Transport/fsockopen.php
    index 56f94c99f2..fc9f6d2a52 100644
    class Requests_Transport_fsockopen implements Requests_Transport { 
    163163                                $request_body = $data;
    164164                        }
    165165
    166                         // Always include Content-length on POST requests to prevent
     166                        // Always include Content-Length on POST requests to prevent
    167167                        // 411 errors from some servers when the body is empty.
    168168                        if (!empty($data) || $options['type'] === Requests::POST) {
    169169                                if (!isset($case_insensitive_headers['Content-Length'])) {
  • src/wp-includes/SimplePie/Misc.php

    diff --git src/wp-includes/SimplePie/Misc.php src/wp-includes/SimplePie/Misc.php
    index ce3cf0f546..e8a4fa5e1b 100644
    class SimplePie_Misc 
    21462146                {
    21472147                        ob_start('ob_gzhandler');
    21482148                }
    2149                 header('Content-type: text/javascript; charset: UTF-8');
     2149                header('Content-Type: text/javascript; charset: UTF-8');
    21502150                header('Cache-Control: must-revalidate');
    21512151                header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days
    21522152                ?>
  • src/wp-includes/class-json.php

    diff --git src/wp-includes/class-json.php src/wp-includes/class-json.php
    index 9eca6f4b57..8e2cb7ca90 100644
    class Services_JSON 
    291291    {
    292292        _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' );
    293293
    294         header('Content-type: application/json');
     294        header('Content-Type: application/json');
    295295        return $this->encodeUnsafe($var);
    296296    }
    297297    /**
  • src/wp-includes/class-simplepie.php

    diff --git src/wp-includes/class-simplepie.php src/wp-includes/class-simplepie.php
    index a392e54cd9..3d639fc709 100644
    class SimplePie 
    18641864        }
    18651865
    18661866        /**
    1867          * Send the content-type header with correct encoding
     1867         * Send the Content-Type header with correct encoding
    18681868         *
    18691869         * This method ensures that the SimplePie-enabled page is being served with
    18701870         * the correct {@link http://www.iana.org/assignments/media-types/ mime-type}
    class SimplePie 
    18861886        {
    18871887                if (!headers_sent())
    18881888                {
    1889                         $header = "Content-type: $mime;";
     1889                        $header = "Content-Type: $mime;";
    18901890                        if ($this->get_encoding())
    18911891                        {
    18921892                                $header .= ' charset=' . $this->get_encoding();
  • src/wp-includes/class-snoopy.php

    diff --git src/wp-includes/class-snoopy.php src/wp-includes/class-snoopy.php
    index fb6857c525..e82c673989 100644
    class Snoopy 
    5353        var $cookies            =       array();                        // array of cookies to pass
    5454                                                                                                // $cookies["username"]="joe";
    5555        var     $rawheaders             =       array();                        // array of raw headers to send
    56                                                                                                 // $rawheaders["Content-type"]="text/html";
     56                                                                                                // $rawheaders["Content-Type"]="text/html";
    5757
    5858        var $maxredirs          =       5;                                      // http redirection depth maximum. 0 = disallow
    5959        var $lastredirectaddr   =       "";                             // contains address of last redirected address
    class Snoopy 
    825825                                $headers .= $headerKey.": ".$headerVal."\r\n";
    826826                }
    827827                if(!empty($content_type)) {
    828                         $headers .= "Content-type: $content_type";
     828                        $headers .= "Content-Type: $content_type";
    829829                        if ($content_type == "multipart/form-data")
    830830                                $headers .= "; boundary=".$this->_mime_boundary;
    831831                        $headers .= "\r\n";
    832832                }
    833833                if(!empty($body))
    834                         $headers .= "Content-length: ".strlen($body)."\r\n";
     834                        $headers .= "Content-Length: ".strlen($body)."\r\n";
    835835                if(!empty($this->user) || !empty($this->pass))
    836836                        $headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n";
    837837
    class Snoopy 
    990990                }
    991991                if(!empty($content_type)) {
    992992                        if ($content_type == "multipart/form-data")
    993                                 $headers[] = "Content-type: $content_type; boundary=".$this->_mime_boundary;
     993                                $headers[] = "Content-Type: $content_type; boundary=".$this->_mime_boundary;
    994994                        else
    995                                 $headers[] = "Content-type: $content_type";
     995                                $headers[] = "Content-Type: $content_type";
    996996                }
    997997                if(!empty($body))
    998                         $headers[] = "Content-length: ".strlen($body);
     998                        $headers[] = "Content-Length: ".strlen($body);
    999999                if(!empty($this->user) || !empty($this->pass))
    10001000                        $headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass);
    10011001
  • src/wp-includes/comment.php

    diff --git src/wp-includes/comment.php src/wp-includes/comment.php
    index 4777b91dff..ddf3f208fa 100644
    function discover_pingback_server_uri( $url, $deprecated = '' ) { 
    28022802                return false;
    28032803        }
    28042804
    2805         if ( wp_remote_retrieve_header( $response, 'x-pingback' ) ) {
    2806                 return wp_remote_retrieve_header( $response, 'x-pingback' );
     2805        if ( wp_remote_retrieve_header( $response, 'X-Pingback' ) ) {
     2806                return wp_remote_retrieve_header( $response, 'X-Pingback' );
    28072807        }
    28082808
    28092809        // Not an (x)html, sgml, or xml page, no use going further.
    2810         if ( preg_match( '#(image|audio|video|model)/#is', wp_remote_retrieve_header( $response, 'content-type' ) ) ) {
     2810        if ( preg_match( '#(image|audio|video|model)/#is', wp_remote_retrieve_header( $response, 'Content-Type' ) ) ) {
    28112811                return false;
    28122812        }
    28132813
  • src/wp-includes/functions.php

    diff --git src/wp-includes/functions.php src/wp-includes/functions.php
    index 946853c361..ab7eb60a77 100644
    function do_enclose( $content, $post ) { 
    945945
    946946                        $headers = wp_get_http_headers( $url );
    947947                        if ( $headers ) {
    948                                 $len           = isset( $headers['content-length'] ) ? (int) $headers['content-length'] : 0;
    949                                 $type          = isset( $headers['content-type'] ) ? $headers['content-type'] : '';
     948                                $len           = isset( $headers['Content-Length'] ) ? (int) $headers['Content-Length'] : 0;
     949                                $type          = isset( $headers['Content-Type'] ) ? $headers['Content-Type'] : '';
    950950                                $allowed_types = array( 'video', 'audio' );
    951951
    952952                                // Check to see if we can figure out the mime type from the extension.
    function do_enclose( $content, $post ) { 
    978978 *
    979979 * @param string $url        URL to retrieve HTTP headers from.
    980980 * @param bool   $deprecated Not Used.
    981  * @return string|false Headers on success, false on failure.
     981 * @return false|Requests_Utility_CaseInsensitiveDictionary Headers on success, false on failure.
    982982 */
    983983function wp_get_http_headers( $url, $deprecated = false ) {
    984984        if ( ! empty( $deprecated ) ) {
  • src/wp-includes/general-template.php

    diff --git src/wp-includes/general-template.php src/wp-includes/general-template.php
    index 1a23cb4316..644513ad2b 100644
    function bloginfo( $show = '' ) { 
    755755 * - 'admin_email' - Admin email (set in Settings > General)
    756756 * - 'charset' - The "Encoding for pages and feeds"  (set in Settings > Reading)
    757757 * - 'version' - The current WordPress version
    758  * - 'html_type' - The content-type (default: "text/html"). Themes and plugins
     758 * - 'html_type' - The Content-Type (default: "text/html"). Themes and plugins
    759759 *   can override the default value using the {@see 'pre_option_html_type'} filter
    760760 * - 'text_direction' - The text direction determined by the site's language. is_rtl()
    761761 *   should be used instead
  • src/wp-includes/pluggable.php

    diff --git src/wp-includes/pluggable.php src/wp-includes/pluggable.php
    index 5ab3eef749..8bdf747aa6 100644
    if ( ! function_exists( 'wp_mail' ) ) : 
    468468
    469469                // Set Content-Type and charset.
    470470
    471                 // If we don't have a content-type from the input headers.
     471                // If we don't have a Content-Type from the input headers.
    472472                if ( ! isset( $content_type ) ) {
    473473                        $content_type = 'text/plain';
    474474                }
  • src/wp-includes/rest-api/class-wp-rest-request.php

    diff --git src/wp-includes/rest-api/class-wp-rest-request.php src/wp-includes/rest-api/class-wp-rest-request.php
    index b93bd36857..1d48c3f70c 100644
    class WP_REST_Request implements ArrayAccess { 
    291291        }
    292292
    293293        /**
    294          * Retrieves the content-type of the request.
     294         * Retrieves the Content-Type of the request.
    295295         *
    296296         * @since 4.4.0
    297297         *
    298298         * @return array|null Map containing 'value' and 'parameters' keys
    299          *                    or null when no valid content-type header was
     299         *                    or null when no valid Content-Type header was
    300300         *                    available.
    301301         */
    302302        public function get_content_type() {
    303                 $value = $this->get_header( 'content-type' );
     303                $value = $this->get_header( 'Content-Type' );
    304304                if ( empty( $value ) ) {
    305305                        return null;
    306306                }
    class WP_REST_Request implements ArrayAccess { 
    325325        }
    326326
    327327        /**
    328          * Checks if the request has specified a JSON content-type.
     328         * Checks if the request has specified a JSON Content-Type.
    329329         *
    330330         * @since 5.6.0
    331331         *
    332          * @return bool True if the content-type header is JSON.
     332         * @return bool True if the Content-Type header is JSON.
    333333         */
    334334        public function is_json_content_type() {
    335335                $content_type = $this->get_content_type();
    class WP_REST_Request implements ArrayAccess { 
    719719                $this->parsed_body = true;
    720720
    721721                /*
    722                  * Check that we got URL-encoded. Treat a missing content-type as
     722                 * Check that we got URL-encoded. Treat a missing Content-Type as
    723723                 * URL-encoded for maximum compatibility.
    724724                 */
    725725                $content_type = $this->get_content_type();
  • src/wp-includes/sitemaps/class-wp-sitemaps-renderer.php

    diff --git src/wp-includes/sitemaps/class-wp-sitemaps-renderer.php src/wp-includes/sitemaps/class-wp-sitemaps-renderer.php
    index 11d5c3820a..9f91a10b7c 100644
    class WP_Sitemaps_Renderer { 
    123123         * @param array $sitemaps Array of sitemap URLs.
    124124         */
    125125        public function render_index( $sitemaps ) {
    126                 header( 'Content-type: application/xml; charset=UTF-8' );
     126                header( 'Content-Type: application/xml; charset=UTF-8' );
    127127
    128128                $this->check_for_simple_xml_availability();
    129129
    class WP_Sitemaps_Renderer { 
    188188         * @param array $url_list Array of URLs for a sitemap.
    189189         */
    190190        public function render_sitemap( $url_list ) {
    191                 header( 'Content-type: application/xml; charset=UTF-8' );
     191                header( 'Content-Type: application/xml; charset=UTF-8' );
    192192
    193193                $this->check_for_simple_xml_availability();
    194194
  • src/wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php

    diff --git src/wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php src/wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php
    index 8268fcc924..f752a7f55f 100644
    class WP_Sitemaps_Stylesheet { 
    2222         * @param string $type Stylesheet type. Either 'sitemap' or 'index'.
    2323         */
    2424        public function render_stylesheet( $type ) {
    25                 header( 'Content-type: application/xml; charset=UTF-8' );
     25                header( 'Content-Type: application/xml; charset=UTF-8' );
    2626
    2727                if ( 'sitemap' === $type ) {
    2828                        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- All content escaped below.
  • src/wp-mail.php

    diff --git src/wp-mail.php src/wp-mail.php
    index d3a86352f2..ddc8874e84 100644
    for ( $i = 1; $i <= $count; $i++ ) { 
    170170                $content = explode( '--' . $boundary, $content );
    171171                $content = $content[2];
    172172
    173                 // Match case-insensitive content-transfer-encoding.
     173                // Match case-insensitive Content-Transfer-Encoding.
    174174                if ( preg_match( '/Content-Transfer-Encoding: quoted-printable/i', $content, $delim ) ) {
    175175                        $content = explode( $delim[0], $content );
    176176                        $content = $content[1];
  • tests/phpunit/data/WPHTTP-testcase-redirection-script.php

    diff --git tests/phpunit/data/WPHTTP-testcase-redirection-script.php tests/phpunit/data/WPHTTP-testcase-redirection-script.php
    index a73e8c6e09..94643d3de9 100644
    if ( isset($_GET['201-location']) ) { 
    3636}
    3737if ( isset($_GET['header-check']) ) {
    3838        $out = array();
    39         header("Content-type: text/plain");
     39        header("Content-Type: text/plain");
    4040        foreach ( $_SERVER as $key => $value ) {
    4141                if ( stripos($key, 'http') === 0 ) {
    4242                        $key = strtolower(substr($key, 5));
    if ( isset( $_GET['post-redirect-to-method'] ) ) { 
    6363
    6464        echo $method;
    6565        exit;
    66        
     66
    6767}
    6868
    6969if ( isset( $_GET['location-with-200'] ) ) {
  • tests/phpunit/tests/admin/includesFile.php

    diff --git tests/phpunit/tests/admin/includesFile.php tests/phpunit/tests/admin/includesFile.php
    index b598a2d3bd..38d66e8354 100644
    class Tests_Admin_IncludesFile extends WP_UnitTestCase { 
    156156                                'code' => 200,
    157157                        ),
    158158                        'headers'  => array(
    159                                 'content-disposition' => 'attachment; filename="filename-from-content-disposition-header.txt"',
     159                                'Content-Disposition' => 'attachment; filename="filename-from-content-disposition-header.txt"',
    160160                        ),
    161161                );
    162162        }
    class Tests_Admin_IncludesFile extends WP_UnitTestCase { 
    174174                                'code' => 200,
    175175                        ),
    176176                        'headers'  => array(
    177                                 'content-disposition' => 'attachment; filename="../../filename-from-content-disposition-header.txt"',
     177                                'Content-Disposition' => 'attachment; filename="../../filename-from-content-disposition-header.txt"',
    178178                        ),
    179179                );
    180180        }
    class Tests_Admin_IncludesFile extends WP_UnitTestCase { 
    192192                                'code' => 200,
    193193                        ),
    194194                        'headers'  => array(
    195                                 'content-disposition' => 'attachment; filename=filename-from-content-disposition-header.txt',
     195                                'Content-Disposition' => 'attachment; filename=filename-from-content-disposition-header.txt',
    196196                        ),
    197197                );
    198198        }
    class Tests_Admin_IncludesFile extends WP_UnitTestCase { 
    241241                                'code' => 200,
    242242                        ),
    243243                        'headers'  => array(
    244                                 'content-disposition' => 'filename="filename-from-content-disposition-header.txt"',
     244                                'Content-Disposition' => 'filename="filename-from-content-disposition-header.txt"',
    245245                        ),
    246246                );
    247247        }
    class Tests_Admin_IncludesFile extends WP_UnitTestCase { 
    259259                                'code' => 200,
    260260                        ),
    261261                        'headers'  => array(
    262                                 'content-disposition' => 'inline; filename="filename-from-content-disposition-header.txt"',
     262                                'Content-Disposition' => 'inline; filename="filename-from-content-disposition-header.txt"',
    263263                        ),
    264264                );
    265265        }
    class Tests_Admin_IncludesFile extends WP_UnitTestCase { 
    277277                                'code' => 200,
    278278                        ),
    279279                        'headers'  => array(
    280                                 'content-disposition' => 'form-data; name="file"; filename="filename-from-content-disposition-header.txt"',
     280                                'Content-Disposition' => 'form-data; name="file"; filename="filename-from-content-disposition-header.txt"',
    281281                        ),
    282282                );
    283283        }
  • tests/phpunit/tests/functions/doEnclose.php

    diff --git tests/phpunit/tests/functions/doEnclose.php tests/phpunit/tests/functions/doEnclose.php
    index 6c06f35182..71d96edbac 100644
    class Tests_Functions_DoEnclose extends WP_UnitTestCase { 
    265265                $fake_headers = array(
    266266                        'mp4' => array(
    267267                                'headers' => array(
    268                                         'content-length' => 123,
    269                                         'content-type'   => 'video/mp4',
     268                                        'Content-Length' => 123,
     269                                        'Content-Type'   => 'video/mp4',
    270270                                ),
    271271                        ),
    272272                        'ogg' => array(
    273273                                'headers' => array(
    274                                         'content-length' => 321,
    275                                         'content-type'   => 'audio/ogg',
     274                                        'Content-Length' => 321,
     275                                        'Content-Type'   => 'audio/ogg',
    276276                                ),
    277277                        ),
    278278                );
    class Tests_Functions_DoEnclose extends WP_UnitTestCase { 
    289289                // Fallback header.
    290290                return array(
    291291                        'headers' => array(
    292                                 'content-length' => 0,
    293                                 'content-type'   => '',
     292                                'Content-Length' => 0,
     293                                'Content-Type'   => '',
    294294                        ),
    295295                );
    296296        }
  • tests/phpunit/tests/http/base.php

    diff --git tests/phpunit/tests/http/base.php tests/phpunit/tests/http/base.php
    index ee42056bb3..9d64f572a8 100644
    abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase { 
    283283                $this->skipTestOnTimeout( $res );
    284284                $this->assertNotWPError( $res );
    285285                $this->assertSame( '', $res['body'] ); // The body should be empty.
    286                 $this->assertEquals( $size, $res['headers']['content-length'] );   // Check the headers are returned (and the size is the same).
     286                $this->assertEquals( $size, $res['headers']['Content-Length'] );   // Check the headers are returned (and the size is the same).
    287287                $this->assertSame( $size, $filesize ); // Check that the file is written to disk correctly without any extra characters.
    288288                $this->assertStringStartsWith( get_temp_dir(), $res['filename'] ); // Check it's saving within the temp directory.
    289289        }
    abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase { 
    450450                $res = wp_remote_head( $url, array( 'timeout' => 30 ) );
    451451
    452452                $this->skipTestOnTimeout( $res );
    453                 $this->assertIsArray( wp_remote_retrieve_header( $res, 'location' ) );
    454                 $this->assertCount( 2, wp_remote_retrieve_header( $res, 'location' ) );
     453                $this->assertIsArray( wp_remote_retrieve_header( $res, 'Location' ) );
     454                $this->assertCount( 2, wp_remote_retrieve_header( $res, 'Location' ) );
    455455
    456456                $res = wp_remote_get( $url, array( 'timeout' => 30 ) );
    457457
  • tests/phpunit/tests/http/functions.php

    diff --git tests/phpunit/tests/http/functions.php tests/phpunit/tests/http/functions.php
    index 49854e0053..40e51cb071 100644
    class Tests_HTTP_Functions extends WP_UnitTestCase { 
    2020
    2121                $this->assertIsArray( $response );
    2222
    23                 $this->assertSame( 'image/jpeg', $headers['content-type'] );
    24                 $this->assertSame( '40148', $headers['content-length'] );
     23                $this->assertSame( 'image/jpeg', $headers['Content-Type'] );
     24                $this->assertSame( '40148', $headers['Content-Length'] );
    2525                $this->assertSame( 200, wp_remote_retrieve_response_code( $response ) );
    2626        }
    2727
    class Tests_HTTP_Functions extends WP_UnitTestCase { 
    6565                $this->assertIsArray( $response );
    6666
    6767                // Should return the same headers as a HEAD request.
    68                 $this->assertSame( 'image/jpeg', $headers['content-type'] );
    69                 $this->assertSame( '40148', $headers['content-length'] );
     68                $this->assertSame( 'image/jpeg', $headers['Content-Type'] );
     69                $this->assertSame( '40148', $headers['Content-Length'] );
    7070                $this->assertSame( 200, wp_remote_retrieve_response_code( $response ) );
    7171        }
    7272
    class Tests_HTTP_Functions extends WP_UnitTestCase { 
    8686                $headers = wp_remote_retrieve_headers( $response );
    8787
    8888                // Should return the same headers as a HEAD request.
    89                 $this->assertSame( 'image/jpeg', $headers['content-type'] );
    90                 $this->assertSame( '40148', $headers['content-length'] );
     89                $this->assertSame( 'image/jpeg', $headers['Content-Type'] );
     90                $this->assertSame( '40148', $headers['Content-Length'] );
    9191                $this->assertSame( 200, wp_remote_retrieve_response_code( $response ) );
    9292        }
    9393
  • tests/phpunit/tests/post/wpAfterInsertPost.php

    diff --git tests/phpunit/tests/post/wpAfterInsertPost.php tests/phpunit/tests/post/wpAfterInsertPost.php
    index c81ad21387..f184c66e01 100644
    class Tests_Post_wpAfterInsertPost extends WP_UnitTestCase { 
    171171                $post_id = self::$post_id;
    172172
    173173                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', $post_id ) );
    174                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     174                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    175175                $request->set_body_params( array( 'title' => 'new title' ) );
    176176                rest_get_server()->dispatch( $request );
    177177
    class Tests_Post_wpAfterInsertPost extends WP_UnitTestCase { 
    188188                wp_set_current_user( self::$admin_id );
    189189
    190190                $request = new WP_REST_Request( 'POST', sprintf( '/wp/v2/posts' ) );
    191                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     191                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    192192                $request->set_body_params(
    193193                        array(
    194194                                'title'  => 'new title',
    class Tests_Post_wpAfterInsertPost extends WP_UnitTestCase { 
    211211                $attachment_id = self::$attachment_id;
    212212
    213213                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/media/%d', $attachment_id ) );
    214                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     214                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    215215                $request->set_body_params( array( 'title' => 'new attachment title' ) );
    216216                rest_get_server()->dispatch( $request );
    217217
  • tests/phpunit/tests/rest-api/rest-autosaves-controller.php

    diff --git tests/phpunit/tests/rest-api/rest-autosaves-controller.php tests/phpunit/tests/rest-api/rest-autosaves-controller.php
    index 2a7eacb8b9..4d9ca15531 100644
    class WP_Test_REST_Autosaves_Controller extends WP_Test_REST_Post_Type_Controlle 
    311311                wp_set_current_user( self::$editor_id );
    312312
    313313                $request = new WP_REST_Request( 'POST', '/wp/v2/posts/' . self::$post_id . '/autosaves' );
    314                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     314                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    315315
    316316                $params = $this->set_post_data(
    317317                        array(
    class WP_Test_REST_Autosaves_Controller extends WP_Test_REST_Post_Type_Controlle 
    327327        public function test_update_item() {
    328328                wp_set_current_user( self::$editor_id );
    329329                $request = new WP_REST_Request( 'POST', '/wp/v2/posts/' . self::$post_id . '/autosaves' );
    330                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     330                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    331331
    332332                $params = $this->set_post_data(
    333333                        array(
    class WP_Test_REST_Autosaves_Controller extends WP_Test_REST_Post_Type_Controlle 
    346346                wp_set_current_user( self::$contributor_id );
    347347
    348348                $request = new WP_REST_Request( 'POST', '/wp/v2/posts/' . self::$post_id . '/autosaves' );
    349                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     349                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    350350
    351351                $params = $this->set_post_data(
    352352                        array(
    class WP_Test_REST_Autosaves_Controller extends WP_Test_REST_Post_Type_Controlle 
    365365                wp_set_current_user( self::$editor_id );
    366366
    367367                $request = new WP_REST_Request( 'POST', '/wp/v2/posts/' . self::$post_id . '/autosaves' );
    368                 $request->add_header( 'content-type', 'application/json' );
     368                $request->add_header( 'Content-Type', 'application/json' );
    369369
    370370                $current_post = get_post( self::$post_id );
    371371
    class WP_Test_REST_Autosaves_Controller extends WP_Test_REST_Post_Type_Controlle 
    412412                );
    413413
    414414                $request = new WP_REST_Request( 'POST', '/wp/v2/posts/' . self::$post_id . '/autosaves' );
    415                 $request->add_header( 'content-type', 'application/json' );
     415                $request->add_header( 'Content-Type', 'application/json' );
    416416                $request->set_body( wp_json_encode( $autosave_data ) );
    417417
    418418                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Autosaves_Controller extends WP_Test_REST_Post_Type_Controlle 
    451451                );
    452452
    453453                $request = new WP_REST_Request( 'POST', '/wp/v2/posts/' . self::$post_id . '/autosaves' );
    454                 $request->add_header( 'content-type', 'application/json' );
     454                $request->add_header( 'Content-Type', 'application/json' );
    455455                $request->set_body( wp_json_encode( $autosave_data ) );
    456456
    457457                $response     = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Autosaves_Controller extends WP_Test_REST_Post_Type_Controlle 
    572572        public function test_update_item_draft_page_with_parent() {
    573573                wp_set_current_user( self::$editor_id );
    574574                $request = new WP_REST_Request( 'POST', '/wp/v2/pages/' . self::$child_draft_page_id . '/autosaves' );
    575                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     575                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    576576
    577577                $params = $this->set_post_data(
    578578                        array(
    class WP_Test_REST_Autosaves_Controller extends WP_Test_REST_Post_Type_Controlle 
    593593                wp_set_current_user( self::$editor_id );
    594594
    595595                $request = new WP_REST_Request( 'POST', '/wp/v2/pages/' . self::$draft_page_id . '/autosaves' );
    596                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     596                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    597597
    598598                $params = $this->set_post_data(
    599599                        array(
    class WP_Test_REST_Autosaves_Controller extends WP_Test_REST_Post_Type_Controlle 
    648648
    649649                // Initiate an autosave via the REST API as Gutenberg does.
    650650                $request = new WP_REST_Request( 'POST', '/wp/v2/posts/' . self::$post_id . '/autosaves' );
    651                 $request->add_header( 'content-type', 'application/json' );
     651                $request->add_header( 'Content-Type', 'application/json' );
    652652                $request->set_body( wp_json_encode( $autosave_data ) );
    653653
    654654                $response = rest_get_server()->dispatch( $request );
  • tests/phpunit/tests/rest-api/rest-block-renderer-controller.php

    diff --git tests/phpunit/tests/rest-api/rest-block-renderer-controller.php tests/phpunit/tests/rest-api/rest-block-renderer-controller.php
    index 9f2401e893..7f7b468fe4 100644
    class REST_Block_Renderer_Controller_Test extends WP_Test_REST_Controller_Testca 
    501501                $attributes       = array( 'some_string' => $string_attribute );
    502502                $request          = new WP_REST_Request( 'POST', self::$rest_api_route . self::$block_name );
    503503                $request->set_param( 'context', 'edit' );
    504                 $request->set_header( 'content-type', 'application/json' );
     504                $request->set_header( 'Content-Type', 'application/json' );
    505505                $request->set_body( wp_json_encode( compact( 'attributes' ) ) );
    506506                $response = rest_get_server()->dispatch( $request );
    507507
  • tests/phpunit/tests/rest-api/rest-comments-controller.php

    diff --git tests/phpunit/tests/rest-api/rest-comments-controller.php tests/phpunit/tests/rest-api/rest-comments-controller.php
    index eb66ee5d41..0c3b27410c 100644
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    11331133                );
    11341134
    11351135                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1136                 $request->add_header( 'content-type', 'application/json' );
     1136                $request->add_header( 'Content-Type', 'application/json' );
    11371137                $request->set_body( wp_json_encode( $params ) );
    11381138
    11391139                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    12391239                );
    12401240
    12411241                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1242                 $request->add_header( 'content-type', 'application/json' );
     1242                $request->add_header( 'Content-Type', 'application/json' );
    12431243                $request->set_body( wp_json_encode( $params ) );
    12441244
    12451245                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    12641264                );
    12651265
    12661266                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1267                 $request->add_header( 'content-type', 'application/json' );
     1267                $request->add_header( 'Content-Type', 'application/json' );
    12681268                $request->set_body( wp_json_encode( $params ) );
    12691269
    12701270                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    12871287                );
    12881288
    12891289                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1290                 $request->add_header( 'content-type', 'application/json' );
     1290                $request->add_header( 'Content-Type', 'application/json' );
    12911291                $request->set_body( wp_json_encode( $params ) );
    12921292
    12931293                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    13071307                );
    13081308
    13091309                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1310                 $request->add_header( 'content-type', 'application/json' );
     1310                $request->add_header( 'Content-Type', 'application/json' );
    13111311                $request->set_body( wp_json_encode( $params ) );
    13121312
    13131313                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    13271327                );
    13281328
    13291329                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1330                 $request->add_header( 'content-type', 'application/json' );
     1330                $request->add_header( 'Content-Type', 'application/json' );
    13311331                $request->set_body( wp_json_encode( $params ) );
    13321332
    13331333                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    13471347                );
    13481348
    13491349                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1350                 $request->add_header( 'content-type', 'application/json' );
     1350                $request->add_header( 'Content-Type', 'application/json' );
    13511351                $request->set_body( wp_json_encode( $params ) );
    13521352
    13531353                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    13651365                );
    13661366
    13671367                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1368                 $request->add_header( 'content-type', 'application/json' );
     1368                $request->add_header( 'Content-Type', 'application/json' );
    13691369                $request->set_body( wp_json_encode( $params ) );
    13701370                $response = rest_get_server()->dispatch( $request );
    13711371
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    13861386                );
    13871387
    13881388                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1389                 $request->add_header( 'content-type', 'application/json' );
     1389                $request->add_header( 'Content-Type', 'application/json' );
    13901390                $request->set_body( wp_json_encode( $params ) );
    13911391
    13921392                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    14131413                );
    14141414
    14151415                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1416                 $request->add_header( 'content-type', 'application/json' );
     1416                $request->add_header( 'Content-Type', 'application/json' );
    14171417                $request->set_body( wp_json_encode( $params ) );
    14181418
    14191419                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    14351435                );
    14361436
    14371437                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1438                 $request->add_header( 'content-type', 'application/json' );
     1438                $request->add_header( 'Content-Type', 'application/json' );
    14391439                $request->set_body( wp_json_encode( $params ) );
    14401440
    14411441                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    14601460                );
    14611461
    14621462                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1463                 $request->add_header( 'content-type', 'application/json' );
     1463                $request->add_header( 'Content-Type', 'application/json' );
    14641464                $request->set_body( wp_json_encode( $params ) );
    14651465
    14661466                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    14811481                );
    14821482
    14831483                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1484                 $request->add_header( 'content-type', 'application/json' );
     1484                $request->add_header( 'Content-Type', 'application/json' );
    14851485                $request->set_body( wp_json_encode( $params ) );
    14861486
    14871487                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    15101510                );
    15111511
    15121512                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1513                 $request->add_header( 'content-type', 'application/json' );
     1513                $request->add_header( 'Content-Type', 'application/json' );
    15141514                $request->set_body( wp_json_encode( $params ) );
    15151515                $response = rest_get_server()->dispatch( $request );
    15161516                $this->assertSame( 201, $response->get_status() );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    15361536                );
    15371537
    15381538                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1539                 $request->add_header( 'content-type', 'application/json' );
     1539                $request->add_header( 'Content-Type', 'application/json' );
    15401540                $request->set_body( wp_json_encode( $params ) );
    15411541
    15421542                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    15751575                );
    15761576
    15771577                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1578                 $request->add_header( 'content-type', 'application/json' );
     1578                $request->add_header( 'Content-Type', 'application/json' );
    15791579                $request->set_body( wp_json_encode( $params ) );
    15801580
    15811581                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    15981598                );
    15991599
    16001600                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1601                 $request->add_header( 'content-type', 'application/json' );
     1601                $request->add_header( 'Content-Type', 'application/json' );
    16021602                $request->set_body( wp_json_encode( $params ) );
    16031603
    16041604                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    16251625                );
    16261626
    16271627                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1628                 $request->add_header( 'content-type', 'application/json' );
     1628                $request->add_header( 'Content-Type', 'application/json' );
    16291629                $request->set_body( wp_json_encode( $params ) );
    16301630                $response = rest_get_server()->dispatch( $request );
    16311631
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    16541654                );
    16551655
    16561656                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1657                 $request->add_header( 'content-type', 'application/json' );
     1657                $request->add_header( 'Content-Type', 'application/json' );
    16581658                $request->set_body( wp_json_encode( $params ) );
    16591659                $response = rest_get_server()->dispatch( $request );
    16601660
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    16791679                );
    16801680
    16811681                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1682                 $request->add_header( 'content-type', 'application/json' );
     1682                $request->add_header( 'Content-Type', 'application/json' );
    16831683                $request->set_body( wp_json_encode( $params ) );
    16841684                $response = rest_get_server()->dispatch( $request );
    16851685
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    16991699                );
    17001700
    17011701                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1702                 $request->add_header( 'content-type', 'application/json' );
     1702                $request->add_header( 'Content-Type', 'application/json' );
    17031703                $request->set_body( wp_json_encode( $params ) );
    17041704                $response = rest_get_server()->dispatch( $request );
    17051705
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    17201720                );
    17211721
    17221722                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1723                 $request->add_header( 'content-type', 'application/json' );
     1723                $request->add_header( 'Content-Type', 'application/json' );
    17241724                $request->set_body( wp_json_encode( $params ) );
    17251725                $response = rest_get_server()->dispatch( $request );
    17261726
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    17441744                );
    17451745
    17461746                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1747                 $request->add_header( 'content-type', 'application/json' );
     1747                $request->add_header( 'Content-Type', 'application/json' );
    17481748                $request->set_body( wp_json_encode( $params ) );
    17491749
    17501750                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    17681768                );
    17691769
    17701770                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1771                 $request->add_header( 'content-type', 'application/json' );
    1772                 $request->add_header( 'user_agent', 'Mozilla/4.0 (compatible; MSIE 5.5; AOL 4.0; Windows 95)' );
     1771                $request->add_header( 'Content-Type', 'application/json' );
     1772                $request->add_header( 'User-Agent', 'Mozilla/4.0 (compatible; MSIE 5.5; AOL 4.0; Windows 95)' );
    17731773                $request->set_body( wp_json_encode( $params ) );
    17741774
    17751775                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    17941794                        'status'       => 'approved',
    17951795                );
    17961796                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1797                 $request->add_header( 'content-type', 'application/json' );
     1797                $request->add_header( 'Content-Type', 'application/json' );
    17981798                $request->set_body( wp_json_encode( $params ) );
    17991799                $response    = rest_get_server()->dispatch( $request );
    18001800                $data        = $response->get_data();
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    18151815                        'status'       => 'approved',
    18161816                );
    18171817                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1818                 $request->add_header( 'content-type', 'application/json' );
     1818                $request->add_header( 'Content-Type', 'application/json' );
    18191819                $request->set_body( wp_json_encode( $params ) );
    18201820
    18211821                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    18351835                );
    18361836
    18371837                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1838                 $request->add_header( 'content-type', 'application/json' );
     1838                $request->add_header( 'Content-Type', 'application/json' );
    18391839                $request->set_body( wp_json_encode( $params ) );
    18401840                $response = rest_get_server()->dispatch( $request );
    18411841                $this->assertErrorResponse( 'rest_comment_invalid_author_ip', $response, 403 );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    18551855                );
    18561856
    18571857                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1858                 $request->add_header( 'content-type', 'application/json' );
     1858                $request->add_header( 'Content-Type', 'application/json' );
    18591859                $request->set_body( wp_json_encode( $params ) );
    18601860                $response    = rest_get_server()->dispatch( $request );
    18611861                $data        = $response->get_data();
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    18751875                );
    18761876
    18771877                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1878                 $request->add_header( 'content-type', 'application/json' );
     1878                $request->add_header( 'Content-Type', 'application/json' );
    18791879                $request->set_body( wp_json_encode( $params ) );
    18801880
    18811881                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    18951895                );
    18961896
    18971897                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1898                 $request->add_header( 'content-type', 'application/json' );
     1898                $request->add_header( 'Content-Type', 'application/json' );
    18991899                $request->set_body( wp_json_encode( $params ) );
    19001900
    19011901                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    19151915                );
    19161916
    19171917                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1918                 $request->add_header( 'content-type', 'application/json' );
     1918                $request->add_header( 'Content-Type', 'application/json' );
    19191919                $request->set_body( wp_json_encode( $params ) );
    19201920
    19211921                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    19351935                );
    19361936
    19371937                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1938                 $request->add_header( 'content-type', 'application/json' );
     1938                $request->add_header( 'Content-Type', 'application/json' );
    19391939                $request->set_body( wp_json_encode( $params ) );
    19401940
    19411941                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    19551955                );
    19561956
    19571957                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1958                 $request->add_header( 'content-type', 'application/json' );
     1958                $request->add_header( 'Content-Type', 'application/json' );
    19591959                $request->set_body( wp_json_encode( $params ) );
    19601960
    19611961                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    19761976                );
    19771977
    19781978                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1979                 $request->add_header( 'content-type', 'application/json' );
     1979                $request->add_header( 'Content-Type', 'application/json' );
    19801980                $request->set_body( wp_json_encode( $params ) );
    19811981
    19821982                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    19961996                );
    19971997
    19981998                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    1999                 $request->add_header( 'content-type', 'application/json' );
     1999                $request->add_header( 'Content-Type', 'application/json' );
    20002000                $request->set_body( wp_json_encode( $params ) );
    20012001
    20022002                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    20232023                );
    20242024
    20252025                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    2026                 $request->add_header( 'content-type', 'application/json' );
     2026                $request->add_header( 'Content-Type', 'application/json' );
    20272027                $request->set_body( wp_json_encode( $params ) );
    20282028                $response = rest_get_server()->dispatch( $request );
    20292029
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    20442044                );
    20452045
    20462046                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    2047                 $request->add_header( 'content-type', 'application/json' );
     2047                $request->add_header( 'Content-Type', 'application/json' );
    20482048                $request->set_body( wp_json_encode( $params ) );
    20492049                $response = rest_get_server()->dispatch( $request );
    20502050
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    20752075                );
    20762076
    20772077                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    2078                 $request->add_header( 'content-type', 'application/json' );
     2078                $request->add_header( 'Content-Type', 'application/json' );
    20792079                $request->set_body( wp_json_encode( $params ) );
    20802080
    20812081                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    20932093                );
    20942094
    20952095                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    2096                 $request->add_header( 'content-type', 'application/json' );
     2096                $request->add_header( 'Content-Type', 'application/json' );
    20972097                $request->set_body( wp_json_encode( $params ) );
    20982098
    20992099                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    21172117                );
    21182118
    21192119                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    2120                 $request->add_header( 'content-type', 'application/json' );
     2120                $request->add_header( 'Content-Type', 'application/json' );
    21212121                $request->set_body( wp_json_encode( $params ) );
    21222122
    21232123                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    21322132                );
    21332133
    21342134                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    2135                 $request->add_header( 'content-type', 'application/json' );
     2135                $request->add_header( 'Content-Type', 'application/json' );
    21362136                $request->set_body( wp_json_encode( $params ) );
    21372137
    21382138                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    21562156                );
    21572157
    21582158                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    2159                 $request->add_header( 'content-type', 'application/json' );
     2159                $request->add_header( 'Content-Type', 'application/json' );
    21602160                $request->set_body( wp_json_encode( $params ) );
    21612161
    21622162                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    21832183
    21842184                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    21852185
    2186                 $request->add_header( 'content-type', 'application/json' );
     2186                $request->add_header( 'Content-Type', 'application/json' );
    21872187                $request->set_body( wp_json_encode( $params ) );
    21882188                $response = rest_get_server()->dispatch( $request );
    21892189
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    22072207
    22082208                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    22092209
    2210                 $request->add_header( 'content-type', 'application/json' );
     2210                $request->add_header( 'Content-Type', 'application/json' );
    22112211                $request->set_body( wp_json_encode( $params ) );
    22122212                $response = rest_get_server()->dispatch( $request );
    22132213
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    22312231
    22322232                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    22332233
    2234                 $request->add_header( 'content-type', 'application/json' );
     2234                $request->add_header( 'Content-Type', 'application/json' );
    22352235                $request->set_body( wp_json_encode( $params ) );
    22362236                $response = rest_get_server()->dispatch( $request );
    22372237
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    22552255
    22562256                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    22572257
    2258                 $request->add_header( 'content-type', 'application/json' );
     2258                $request->add_header( 'Content-Type', 'application/json' );
    22592259                $request->set_body( wp_json_encode( $params ) );
    22602260                $response = rest_get_server()->dispatch( $request );
    22612261
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    22752275
    22762276                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    22772277
    2278                 $request->add_header( 'content-type', 'application/json' );
     2278                $request->add_header( 'Content-Type', 'application/json' );
    22792279                $request->set_body( wp_json_encode( $params ) );
    22802280                $response = rest_get_server()->dispatch( $request );
    22812281
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    22962296
    22972297                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    22982298
    2299                 $request->add_header( 'content-type', 'application/json' );
     2299                $request->add_header( 'Content-Type', 'application/json' );
    23002300                $request->set_body( wp_json_encode( $params ) );
    23012301                $response = rest_get_server()->dispatch( $request );
    23022302                $this->assertSame( 201, $response->get_status() );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    23192319                );
    23202320
    23212321                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
    2322                 $request->add_header( 'content-type', 'application/json' );
     2322                $request->add_header( 'Content-Type', 'application/json' );
    23232323                $request->set_body( wp_json_encode( $params ) );
    23242324
    23252325                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    24242424                );
    24252425
    24262426                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', $comment_id ) );
    2427                 $request->add_header( 'content-type', 'application/json' );
     2427                $request->add_header( 'Content-Type', 'application/json' );
    24282428                $request->set_body( wp_json_encode( $params ) );
    24292429
    24302430                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    24522452                );
    24532453
    24542454                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', $comment_id ) );
    2455                 $request->add_header( 'content-type', 'application/json' );
     2455                $request->add_header( 'Content-Type', 'application/json' );
    24562456                $request->set_body( wp_json_encode( $params ) );
    24572457
    24582458                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    24742474                );
    24752475
    24762476                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
    2477                 $request->add_header( 'content-type', 'application/json' );
     2477                $request->add_header( 'Content-Type', 'application/json' );
    24782478                $request->set_body( wp_json_encode( $params ) );
    24792479
    24802480                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    24982498                );
    24992499
    25002500                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
    2501                 $request->add_header( 'content-type', 'application/json' );
     2501                $request->add_header( 'Content-Type', 'application/json' );
    25022502                $request->set_body( wp_json_encode( $params ) );
    25032503
    25042504                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    25182518                );
    25192519
    25202520                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
    2521                 $request->add_header( 'content-type', 'application/json' );
     2521                $request->add_header( 'Content-Type', 'application/json' );
    25222522                $request->set_body( wp_json_encode( $params ) );
    25232523
    25242524                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    25372537                );
    25382538
    25392539                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
    2540                 $request->add_header( 'content-type', 'application/json' );
     2540                $request->add_header( 'Content-Type', 'application/json' );
    25412541                $request->set_body( wp_json_encode( $params ) );
    25422542
    25432543                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    25572557                );
    25582558
    25592559                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
    2560                 $request->add_header( 'content-type', 'application/json' );
     2560                $request->add_header( 'Content-Type', 'application/json' );
    25612561                $request->set_body( wp_json_encode( $params ) );
    25622562
    25632563                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    25752575                );
    25762576
    25772577                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
    2578                 $request->add_header( 'content-type', 'application/json' );
     2578                $request->add_header( 'Content-Type', 'application/json' );
    25792579                $request->set_body( wp_json_encode( $params ) );
    25802580                $response = rest_get_server()->dispatch( $request );
    25812581
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    25922592                );
    25932593
    25942594                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
    2595                 $request->add_header( 'content-type', 'application/json' );
     2595                $request->add_header( 'Content-Type', 'application/json' );
    25962596                $request->set_body( wp_json_encode( $params ) );
    25972597
    25982598                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    26092609                );
    26102610
    26112611                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
    2612                 $request->add_header( 'content-type', 'application/json' );
     2612                $request->add_header( 'Content-Type', 'application/json' );
    26132613                $request->set_body( wp_json_encode( $params ) );
    26142614
    26152615                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    26302630                );
    26312631
    26322632                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
    2633                 $request->add_header( 'content-type', 'application/json' );
     2633                $request->add_header( 'Content-Type', 'application/json' );
    26342634                $request->set_body( wp_json_encode( $params ) );
    26352635
    26362636                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    26462646                );
    26472647
    26482648                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
    2649                 $request->add_header( 'content-type', 'application/json' );
     2649                $request->add_header( 'Content-Type', 'application/json' );
    26502650                $request->set_body( wp_json_encode( $params ) );
    26512651
    26522652                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    26612661                );
    26622662
    26632663                $request = new WP_REST_Request( 'PUT', '/wp/v2/comments/' . REST_TESTS_IMPOSSIBLY_HIGH_NUMBER );
    2664                 $request->add_header( 'content-type', 'application/json' );
     2664                $request->add_header( 'Content-Type', 'application/json' );
    26652665                $request->set_body( wp_json_encode( $params ) );
    26662666
    26672667                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    26862686                );
    26872687
    26882688                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$hold_id ) );
    2689                 $request->add_header( 'content-type', 'application/json' );
     2689                $request->add_header( 'Content-Type', 'application/json' );
    26902690                $request->set_body( wp_json_encode( $params ) );
    26912691
    26922692                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    27052705                );
    27062706
    27072707                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
    2708                 $request->add_header( 'content-type', 'application/json' );
     2708                $request->add_header( 'Content-Type', 'application/json' );
    27092709                $request->set_body( wp_json_encode( $params ) );
    27102710
    27112711                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    27352735                );
    27362736
    27372737                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', $private_comment_id ) );
    2738                 $request->add_header( 'content-type', 'application/json' );
     2738                $request->add_header( 'Content-Type', 'application/json' );
    27392739                $request->set_body( wp_json_encode( $params ) );
    27402740
    27412741                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    27942794
    27952795                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
    27962796
    2797                 $request->add_header( 'content-type', 'application/json' );
     2797                $request->add_header( 'Content-Type', 'application/json' );
    27982798                $request->set_body( wp_json_encode( $params ) );
    27992799                $response = rest_get_server()->dispatch( $request );
    28002800
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    28142814
    28152815                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
    28162816
    2817                 $request->add_header( 'content-type', 'application/json' );
     2817                $request->add_header( 'Content-Type', 'application/json' );
    28182818                $request->set_body( wp_json_encode( $params ) );
    28192819                $response = rest_get_server()->dispatch( $request );
    28202820
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    28342834
    28352835                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
    28362836
    2837                 $request->add_header( 'content-type', 'application/json' );
     2837                $request->add_header( 'Content-Type', 'application/json' );
    28382838                $request->set_body( wp_json_encode( $params ) );
    28392839                $response = rest_get_server()->dispatch( $request );
    28402840
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    28532853
    28542854                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
    28552855
    2856                 $request->add_header( 'content-type', 'application/json' );
     2856                $request->add_header( 'Content-Type', 'application/json' );
    28572857                $request->set_body( wp_json_encode( $params ) );
    28582858                $response = rest_get_server()->dispatch( $request );
    28592859
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    28742874
    28752875                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
    28762876
    2877                 $request->add_header( 'content-type', 'application/json' );
     2877                $request->add_header( 'Content-Type', 'application/json' );
    28782878                $request->set_body( wp_json_encode( $params ) );
    28792879                $response = rest_get_server()->dispatch( $request );
    28802880
  • tests/phpunit/tests/rest-api/rest-posts-controller.php

    diff --git tests/phpunit/tests/rest-api/rest-posts-controller.php tests/phpunit/tests/rest-api/rest-posts-controller.php
    index 5fa7e3cf98..eccb1f24c6 100644
    class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    23012301                wp_set_current_user( self::$editor_id );
    23022302
    23032303                $request = new WP_REST_Request( 'POST', '/wp/v2/posts' );
    2304                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     2304                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    23052305                $params = $this->set_post_data();
    23062306                $request->set_body_params( $params );
    23072307                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    24922492                wp_set_current_user( self::$editor_id );
    24932493
    24942494                $request = new WP_REST_Request( 'POST', '/wp/v2/posts' );
    2495                 $request->add_header( 'content-type', 'application/json' );
     2495                $request->add_header( 'Content-Type', 'application/json' );
    24962496                $params = $this->set_post_data();
    24972497                $request->set_body( wp_json_encode( $params ) );
    24982498                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    31233123                wp_set_current_user( self::$editor_id );
    31243124
    31253125                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', self::$post_id ) );
    3126                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     3126                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    31273127                $params = $this->set_post_data();
    31283128                $request->set_body_params( $params );
    31293129                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    31613161                wp_set_current_user( self::$editor_id );
    31623162
    31633163                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', self::$post_id ) );
    3164                 $request->add_header( 'content-type', 'application/json' );
     3164                $request->add_header( 'Content-Type', 'application/json' );
    31653165                $params = $this->set_post_data();
    31663166                $request->set_body( wp_json_encode( $params ) );
    31673167                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    31953195                $future_date = '2919-07-29T18:00:00';
    31963196
    31973197                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', $post_id ) );
    3198                 $request->add_header( 'content-type', 'application/json' );
     3198                $request->add_header( 'Content-Type', 'application/json' );
    31993199                $params = $this->set_post_data(
    32003200                        array(
    32013201                                'date_gmt' => $future_date,
    class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    32173217
    32183218                // Update post with a blank field (date or date_gmt).
    32193219                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', $post_id ) );
    3220                 $request->add_header( 'content-type', 'application/json' );
     3220                $request->add_header( 'Content-Type', 'application/json' );
    32213221                $params = $this->set_post_data(
    32223222                        array(
    32233223                                'date_gmt' => null,
    class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    32443244                wp_set_current_user( self::$editor_id );
    32453245
    32463246                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', self::$post_id ) );
    3247                 $request->add_header( 'content-type', 'application/json' );
     3247                $request->add_header( 'Content-Type', 'application/json' );
    32483248                $params = $this->set_raw_post_data();
    32493249                $request->set_body( wp_json_encode( $params ) );
    32503250                $response = rest_get_server()->dispatch( $request );
  • tests/phpunit/tests/rest-api/rest-request.php

    diff --git tests/phpunit/tests/rest-api/rest-request.php tests/phpunit/tests/rest-api/rest-request.php
    index 509c754f65..cf1f3ac739 100644
    class Tests_REST_Request extends WP_UnitTestCase { 
    203203         * @ticket 49404
    204204         * @dataProvider alternate_json_content_type_provider
    205205         *
    206          * @param string $content_type The content-type header.
     206         * @param string $content_type The Content-Type header.
    207207         * @param string $source       The source value.
    208208         * @param bool   $accept_json  The accept_json value.
    209209         */
    class Tests_REST_Request extends WP_UnitTestCase { 
    234234         * @ticket 49404
    235235         * @dataProvider is_json_content_type_provider
    236236         *
    237          * @param string $content_type The content-type header.
     237         * @param string $content_type The Content-Type header.
    238238         * @param bool   $is_json      The is_json value.
    239239         */
    240240        public function test_is_json_content_type( $content_type, $is_json ) {
    class Tests_REST_Request extends WP_UnitTestCase { 
    242242
    243243                $this->request->set_header( 'Content-Type', $content_type );
    244244
    245                 // Check for JSON content-type.
     245                // Check for JSON Content-Type.
    246246                $this->assertSame( $is_json, $this->request->is_json_content_type() );
    247247        }
    248248
    class Tests_REST_Request extends WP_UnitTestCase { 
    361361                );
    362362
    363363                $this->request->set_method( 'PUT' );
    364                 $this->request->add_header( 'content-type', 'application/json' );
     364                $this->request->add_header( 'Content-Type', 'application/json' );
    365365                $this->request->set_body( wp_json_encode( $data ) );
    366366
    367367                foreach ( $data as $key => $expected_value ) {
    class Tests_REST_Request extends WP_UnitTestCase { 
    383383                );
    384384
    385385                $this->request->set_method( 'POST' );
    386                 $this->request->add_header( 'content-type', 'application/json' );
     386                $this->request->add_header( 'Content-Type', 'application/json' );
    387387                $this->request->set_body( wp_json_encode( $data ) );
    388388
    389389                foreach ( $data as $key => $expected_value ) {
    class Tests_REST_Request extends WP_UnitTestCase { 
    864864
    865865        public function test_set_param_follows_parameter_order() {
    866866                $request = new WP_REST_Request();
    867                 $request->add_header( 'content-type', 'application/json' );
     867                $request->add_header( 'Content-Type', 'application/json' );
    868868                $request->set_method( 'POST' );
    869869                $request->set_body(
    870870                        wp_json_encode(
    class Tests_REST_Request extends WP_UnitTestCase { 
    892892         */
    893893        public function test_set_param_updates_param_in_json_and_query() {
    894894                $request = new WP_REST_Request();
    895                 $request->add_header( 'content-type', 'application/json' );
     895                $request->add_header( 'Content-Type', 'application/json' );
    896896                $request->set_method( 'POST' );
    897897                $request->set_body(
    898898                        wp_json_encode(
    class Tests_REST_Request extends WP_UnitTestCase { 
    919919         */
    920920        public function test_set_param_updates_param_if_already_exists_in_query() {
    921921                $request = new WP_REST_Request();
    922                 $request->add_header( 'content-type', 'application/json' );
     922                $request->add_header( 'Content-Type', 'application/json' );
    923923                $request->set_method( 'POST' );
    924924                $request->set_body(
    925925                        wp_json_encode(
    class Tests_REST_Request extends WP_UnitTestCase { 
    953953         */
    954954        public function test_set_param_to_null_updates_param_in_json_and_query() {
    955955                $request = new WP_REST_Request();
    956                 $request->add_header( 'content-type', 'application/json' );
     956                $request->add_header( 'Content-Type', 'application/json' );
    957957                $request->set_method( 'POST' );
    958958                $request->set_body(
    959959                        wp_json_encode(
    class Tests_REST_Request extends WP_UnitTestCase { 
    980980         */
    981981        public function test_set_param_from_null_updates_param_in_json_and_query_with_null() {
    982982                $request = new WP_REST_Request();
    983                 $request->add_header( 'content-type', 'application/json' );
     983                $request->add_header( 'Content-Type', 'application/json' );
    984984                $request->set_method( 'POST' );
    985985                $request->set_body(
    986986                        wp_json_encode(
    class Tests_REST_Request extends WP_UnitTestCase { 
    10071007         */
    10081008        public function test_set_param_with_invalid_json() {
    10091009                $request = new WP_REST_Request();
    1010                 $request->add_header( 'content-type', 'application/json' );
     1010                $request->add_header( 'Content-Type', 'application/json' );
    10111011                $request->set_method( 'POST' );
    10121012                $request->set_body( '' );
    10131013                $request->set_param( 'param', 'value' );
  • tests/phpunit/tests/rest-api/rest-settings-controller.php

    diff --git tests/phpunit/tests/rest-api/rest-settings-controller.php tests/phpunit/tests/rest-api/rest-settings-controller.php
    index 60a5f28c8d..a2bbcb79c6 100644
    class WP_Test_REST_Settings_Controller extends WP_Test_REST_Controller_Testcase 
    773773                        ),
    774774                );
    775775                $request = new WP_REST_Request( 'PUT', '/wp/v2/settings' );
    776                 $request->add_header( 'content-type', 'application/json' );
     776                $request->add_header( 'Content-Type', 'application/json' );
    777777                $request->set_body( wp_json_encode( $data ) );
    778778
    779779                $response = rest_do_request( $request );
  • tests/phpunit/tests/rest-api/rest-users-controller.php

    diff --git tests/phpunit/tests/rest-api/rest-users-controller.php tests/phpunit/tests/rest-api/rest-users-controller.php
    index 849b0e5464..1f875df16b 100644
    class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 
    12301230                );
    12311231
    12321232                $request = new WP_REST_Request( 'POST', '/wp/v2/users' );
    1233                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     1233                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    12341234                $request->set_body_params( $params );
    12351235                $response = rest_get_server()->dispatch( $request );
    12361236
    class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 
    12631263                }
    12641264
    12651265                $request = new WP_REST_Request( 'POST', '/wp/v2/users' );
    1266                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     1266                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    12671267                $request->set_body_params( $params );
    12681268                $response = rest_get_server()->dispatch( $request );
    12691269                $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
    class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 
    13081308                );
    13091309
    13101310                $request = new WP_REST_Request( 'POST', '/wp/v2/users' );
    1311                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     1311                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    13121312                $request->set_body_params( $params );
    13131313                $response = rest_get_server()->dispatch( $request );
    13141314
    class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 
    13381338                );
    13391339
    13401340                $request = new WP_REST_Request( 'POST', '/wp/v2/users' );
    1341                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     1341                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    13421342                $request->set_body_params( $params );
    13431343                $response = rest_get_server()->dispatch( $request );
    13441344                $data     = $response->get_data();
    class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 
    13691369                add_filter( 'can_add_user_to_blog', '__return_false' );
    13701370
    13711371                $request = new WP_REST_Request( 'POST', '/wp/v2/users' );
    1372                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     1372                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    13731373                $request->set_body_params( $params );
    13741374                $response = rest_get_server()->dispatch( $request );
    13751375                $this->assertErrorResponse( 'user_cannot_be_added', $response );
    class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 
    13921392                switch_to_blog( self::$site );
    13931393
    13941394                $request = new WP_REST_Request( 'POST', '/wp/v2/users' );
    1395                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     1395                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    13961396                $request->set_body_params( $params );
    13971397                $response = rest_get_server()->dispatch( $request );
    13981398                $data     = $response->get_data();
    class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 
    14221422                );
    14231423
    14241424                $request = new WP_REST_Request( 'POST', '/wp/v2/users' );
    1425                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     1425                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    14261426                $request->set_body_params( $params );
    14271427                $response = rest_get_server()->dispatch( $request );
    14281428                $data     = $response->get_data();
    class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 
    14311431                switch_to_blog( self::$site );
    14321432
    14331433                $request = new WP_REST_Request( 'POST', '/wp/v2/users' );
    1434                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     1434                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    14351435                $request->set_body_params( $params );
    14361436                $switched_response = rest_get_server()->dispatch( $request );
    14371437
    class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 
    14701470                );
    14711471
    14721472                $request = new WP_REST_Request( 'POST', '/wp/v2/users' );
    1473                 $request->add_header( 'content-type', 'application/json' );
     1473                $request->add_header( 'Content-Type', 'application/json' );
    14741474                $request->set_body( wp_json_encode( $params ) );
    14751475                $response = rest_get_server()->dispatch( $request );
    14761476
    class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 
    14871487                );
    14881488
    14891489                $request = new WP_REST_Request( 'POST', '/wp/v2/users' );
    1490                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     1490                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    14911491                $request->set_body_params( $params );
    14921492                $response = rest_get_server()->dispatch( $request );
    14931493
    class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 
    15071507                );
    15081508
    15091509                $request = new WP_REST_Request( 'POST', '/wp/v2/users' );
    1510                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     1510                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    15111511                $request->set_body_params( $params );
    15121512                $response = rest_get_server()->dispatch( $request );
    15131513
    class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 
    15261526                );
    15271527
    15281528                $request = new WP_REST_Request( 'POST', '/wp/v2/users' );
    1529                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     1529                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    15301530                $request->set_body_params( $params );
    15311531                $response = rest_get_server()->dispatch( $request );
    15321532
    class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 
    15461546                );
    15471547
    15481548                $request = new WP_REST_Request( 'POST', '/wp/v2/users' );
    1549                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     1549                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    15501550                $request->set_body_params( $params );
    15511551                $response = rest_get_server()->dispatch( $request );
    15521552
    class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 
    15791579                $_POST['locale']     = 'de_DE';
    15801580
    15811581                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/users/%d', $user_id ) );
    1582                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     1582                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    15831583                $request->set_body_params( $_POST );
    15841584                $response = rest_get_server()->dispatch( $request );
    15851585
    class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 
    18261826                $pw_before = $userdata->user_pass;
    18271827
    18281828                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/users/%d', $user_id ) );
    1829                 $request->add_header( 'content-type', 'application/json' );
     1829                $request->add_header( 'Content-Type', 'application/json' );
    18301830                $request->set_body( wp_json_encode( $params ) );
    18311831
    18321832                $response = rest_get_server()->dispatch( $request );
    class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 
    20082008                );
    20092009
    20102010                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/users/%d', self::$user ) );
    2011                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     2011                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    20122012                $request->set_body_params( $params );
    20132013                $response = rest_get_server()->dispatch( $request );
    20142014
    20152015                $this->assertErrorResponse( 'rest_cannot_edit', $response, 403 );
    20162016
    20172017                $request = new WP_REST_Request( 'PUT', '/wp/v2/users/me' );
    2018                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     2018                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    20192019                $request->set_body_params( $params );
    20202020                $response = rest_get_server()->dispatch( $request );
    20212021
    class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 
    20352035                );
    20362036
    20372037                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/users/%d', self::$editor ) );
    2038                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     2038                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    20392039                $request->set_body_params( $params );
    20402040                $response = rest_get_server()->dispatch( $request );
    20412041
    class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 
    28812881                wp_set_current_user( self::$user );
    28822882
    28832883                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/users/%d', $user_id ) );
    2884                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     2884                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    28852885                $request->set_body_params( array( 'first_name' => 'New Name' ) );
    28862886                $response = rest_get_server()->dispatch( $request );
    28872887                $this->assertErrorResponse( 'rest_user_invalid_id', $response, 404 );
    class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 
    29032903                wp_set_current_user( self::$superadmin );
    29042904
    29052905                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/users/%d', $user_id ) );
    2906                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     2906                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    29072907                $request->set_body_params( array( 'first_name' => 'New Name' ) );
    29082908                $response = rest_get_server()->dispatch( $request );
    29092909                $this->assertErrorResponse( 'rest_user_invalid_id', $response, 404 );
  • tests/phpunit/tests/rest-api/rest-widgets-controller.php

    diff --git tests/phpunit/tests/rest-api/rest-widgets-controller.php tests/phpunit/tests/rest-api/rest-widgets-controller.php
    index 28ac8bc6e3..dff2289278 100644
    class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase { 
    412412
    413413        public function mocked_rss_response() {
    414414                $single_value_headers = array(
    415                         'content-type' => 'application/rss+xml; charset=UTF-8',
     415                        'Content-Type' => 'application/rss+xml; charset=UTF-8',
    416416                        'link'         => '<https://wordpress.org/news/wp-json/>; rel="https://api.w.org/"',
    417417                );
    418418
  • tests/phpunit/tests/rest-api/wpRestMenuItemsController.php

    diff --git tests/phpunit/tests/rest-api/wpRestMenuItemsController.php tests/phpunit/tests/rest-api/wpRestMenuItemsController.php
    index 9ef5b87d99..ecbc491256 100644
    class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro 
    318318                wp_set_current_user( self::$admin_id );
    319319
    320320                $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' );
    321                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     321                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    322322                $params = $this->set_menu_item_data();
    323323                $request->set_body_params( $params );
    324324                $response = rest_get_server()->dispatch( $request );
    class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro 
    334334                wp_set_current_user( self::$admin_id );
    335335
    336336                $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' );
    337                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     337                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    338338                $params = $this->set_menu_item_data(
    339339                        array(
    340340                                'menus' => array( 123, 456 ),
    class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro 
    354354                wp_set_current_user( self::$admin_id );
    355355
    356356                $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' );
    357                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     357                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    358358                $params = $this->set_menu_item_data(
    359359                        array(
    360360                                'type'  => 'taxonomy',
    class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro 
    377377                $actual      = array();
    378378                for ( $i = 1; $i < 5; $i ++ ) {
    379379                        $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' );
    380                         $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     380                        $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    381381                        $params = $this->set_menu_item_data(
    382382                                array(
    383383                                        'menu_order' => $i,
    class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro 
    404404                $new_menu_id = wp_create_nav_menu( rand_str() );
    405405
    406406                $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' );
    407                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     407                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    408408                $params = $this->set_menu_item_data(
    409409                        array(
    410410                                'menu_order' => 0,
    class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro 
    416416                $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
    417417
    418418                $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' );
    419                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     419                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    420420                $params = $this->set_menu_item_data(
    421421                        array(
    422422                                'menu_order' => 1,
    class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro 
    436436                wp_set_current_user( self::$admin_id );
    437437                $new_menu_id = wp_create_nav_menu( rand_str() );
    438438                $request     = new WP_REST_Request( 'POST', '/wp/v2/menu-items' );
    439                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     439                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    440440                $params = $this->set_menu_item_data(
    441441                        array(
    442442                                'menu_order' => 'ddddd',
    class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro 
    456456                wp_set_current_user( self::$admin_id );
    457457                $new_menu_id = wp_create_nav_menu( rand_str() );
    458458                $request     = new WP_REST_Request( 'POST', '/wp/v2/menu-items' );
    459                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     459                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    460460                $params = $this->set_menu_item_data(
    461461                        array(
    462462                                'menu_order' => -9,
    class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro 
    476476                wp_set_current_user( self::$admin_id );
    477477                wp_create_nav_menu( rand_str() );
    478478                $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' );
    479                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     479                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    480480                $params = $this->set_menu_item_data(
    481481                        array(
    482482                                'parent' => -9,
    class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro 
    494494        public function test_create_item_invalid_menu() {
    495495                wp_set_current_user( self::$admin_id );
    496496                $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' );
    497                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     497                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    498498                $params = $this->set_menu_item_data(
    499499                        array(
    500500                                'menus' => -9,
    class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro 
    513513                wp_set_current_user( self::$admin_id );
    514514
    515515                $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' );
    516                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     516                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    517517                $params = $this->set_menu_item_data(
    518518                        array(
    519519                                'type'  => 'post_type',
    class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro 
    533533                wp_set_current_user( self::$admin_id );
    534534
    535535                $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' );
    536                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     536                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    537537                $params = $this->set_menu_item_data(
    538538                        array(
    539539                                'type'             => 'post_type_archive',
    class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro 
    553553                wp_set_current_user( self::$admin_id );
    554554
    555555                $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' );
    556                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     556                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    557557                $params = $this->set_menu_item_data(
    558558                        array(
    559559                                'type'  => 'custom',
    class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro 
    573573                wp_set_current_user( self::$admin_id );
    574574
    575575                $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' );
    576                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     576                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    577577                $params = $this->set_menu_item_data(
    578578                        array(
    579579                                'type' => 'custom',
    class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro 
    593593                wp_set_current_user( self::$admin_id );
    594594
    595595                $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' );
    596                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     596                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    597597                $params = $this->set_menu_item_data(
    598598                        array(
    599599                                'type' => 'custom',
    class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro 
    615615                wp_set_current_user( self::$admin_id );
    616616
    617617                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/menu-items/%d', $this->menu_item_id ) );
    618                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     618                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    619619                $params = $this->set_menu_item_data(
    620620                        array(
    621621                                'xfn' => array( 'test1', 'test2', 'test3' ),
    class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro 
    648648                $good_data = array( 'test1', 'test2', 'test3', 'test4' );
    649649
    650650                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/menu-items/%d', $this->menu_item_id ) );
    651                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     651                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    652652                $params = $this->set_menu_item_data(
    653653                        array(
    654654                                'xfn' => $bad_data,
    class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro 
    680680                $post_id = self::factory()->post->create();
    681681
    682682                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/menu-items/%d', $post_id ) );
    683                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     683                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    684684                $params = $this->set_menu_item_data();
    685685                $request->set_body_params( $params );
    686686                $response = rest_get_server()->dispatch( $request );
    class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro 
    10211021                wp_set_current_user( self::$admin_id );
    10221022
    10231023                $request = new WP_REST_Request( 'POST', '/wp/v2/menu-items' );
    1024                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     1024                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    10251025                $parameters = $this->set_menu_item_data(
    10261026                        array(
    10271027                                'title' => 'Some \\\'title',
    class Tests_REST_WpRestMenuItemsController extends WP_Test_REST_Post_Type_Contro 
    10431043                wp_set_current_user( self::$admin_id );
    10441044
    10451045                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/menu-items/%d', $this->menu_item_id ) );
    1046                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     1046                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    10471047                $title  = 'Some \\\'title';
    10481048                $params = $this->set_menu_item_data(
    10491049                        array(
  • tests/phpunit/tests/widgets/wpWidgetRss.php

    diff --git tests/phpunit/tests/widgets/wpWidgetRss.php tests/phpunit/tests/widgets/wpWidgetRss.php
    index 495869f475..e5f65c6d15 100644
    class Tests_Widgets_wpWidgetRss extends WP_UnitTestCase { 
    101101
    102102        public function mocked_rss_response() {
    103103                $single_value_headers = array(
    104                         'content-type' => 'application/rss+xml; charset=UTF-8',
     104                        'Content-Type' => 'application/rss+xml; charset=UTF-8',
    105105                        'link'         => '<https://wordpress.org/news/wp-json/>; rel="https://api.w.org/"',
    106106                );
    107107