Make WordPress Core

Changeset 55210


Ignore:
Timestamp:
02/03/2023 01:33:18 PM (4 years ago)
Author:
audrasjb
Message:

HTTP API: Fix request header inconsistencies.

This changeset improves the consistency in capitalization of fetching and outputting of request headers. It also updates occurrences found in some docblocks.

Props johnjamesjacoby, costdev, audrasjb, petitphp, mhkuu, SergeyBiryukov.
Fixes #54225.

Location:
trunk
Files:
29 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r55111 r55210  
    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         */
  • trunk/src/wp-admin/includes/file.php

    r55204 r55210  
    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 ) {
    … …  
    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 ) {
    … …  
    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 ) {
  • trunk/src/wp-admin/includes/upgrade.php

    r54891 r55210  
    513513                 */
    514514                $response          = wp_remote_get( $test_url, array( 'timeout' => 5 ) );
    515                 $x_pingback_header = wp_remote_retrieve_header( $response, 'x-pingback' );
     515                $x_pingback_header = wp_remote_retrieve_header( $response, 'X-Pingback' );
    516516                $pretty_permalinks = $x_pingback_header && get_bloginfo( 'pingback_url' ) === $x_pingback_header;
    517517
  • trunk/src/wp-includes/class-json.php

    r54759 r55210  
    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    }
  • trunk/src/wp-includes/class-simplepie.php

    r52413 r55210  
    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
    … …  
    18871887                if (!headers_sent())
    18881888                {
    1889                         $header = "Content-type: $mime;";
     1889                        $header = "Content-Type: $mime;";
    18901890                        if ($this->get_encoding())
    18911891                        {
  • trunk/src/wp-includes/class-snoopy.php

    r47735 r55210  
    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
    … …  
    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;
    … …  
    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";
    … …  
    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);
  • trunk/src/wp-includes/comment.php

    r54891 r55210  
    28252825        }
    28262826
    2827         if ( wp_remote_retrieve_header( $response, 'x-pingback' ) ) {
    2828                 return wp_remote_retrieve_header( $response, 'x-pingback' );
     2827        if ( wp_remote_retrieve_header( $response, 'X-Pingback' ) ) {
     2828                return wp_remote_retrieve_header( $response, 'X-Pingback' );
    28292829        }
    28302830
    28312831        // Not an (x)html, sgml, or xml page, no use going further.
    2832         if ( preg_match( '#(image|audio|video|model)/#is', wp_remote_retrieve_header( $response, 'content-type' ) ) ) {
     2832        if ( preg_match( '#(image|audio|video|model)/#is', wp_remote_retrieve_header( $response, 'Content-Type' ) ) ) {
    28332833                return false;
    28342834        }
  • trunk/src/wp-includes/functions.php

    r55117 r55210  
    944944                        $headers = wp_get_http_headers( $url );
    945945                        if ( $headers ) {
    946                                 $len           = isset( $headers['content-length'] ) ? (int) $headers['content-length'] : 0;
    947                                 $type          = isset( $headers['content-type'] ) ? $headers['content-type'] : '';
     946                                $len           = isset( $headers['Content-Length'] ) ? (int) $headers['Content-Length'] : 0;
     947                                $type          = isset( $headers['Content-Type'] ) ? $headers['Content-Type'] : '';
    948948                                $allowed_types = array( 'video', 'audio' );
    949949
  • trunk/src/wp-includes/general-template.php

    r55094 r55210  
    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()
  • trunk/src/wp-includes/pluggable.php

    r55166 r55210  
    464464                // Set Content-Type and charset.
    465465
    466                 // If we don't have a content-type from the input headers.
     466                // If we don't have a Content-Type from the input headers.
    467467                if ( ! isset( $content_type ) ) {
    468468                        $content_type = 'text/plain';
  • trunk/src/wp-includes/rest-api/class-wp-rest-request.php

    r54663 r55210  
    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;
    … …  
    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() {
    … …  
    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                 */
  • trunk/src/wp-includes/sitemaps/class-wp-sitemaps-renderer.php

    r54133 r55210  
    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();
    … …  
    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();
  • trunk/src/wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php

    r54133 r55210  
    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 ) {
  • trunk/src/wp-mail.php

    r55051 r55210  
    172172                $content = $content[2];
    173173
    174                 // Match case-insensitive content-transfer-encoding.
     174                // Match case-insensitive Content-Transfer-Encoding.
    175175                if ( preg_match( '/Content-Transfer-Encoding: quoted-printable/i', $content, $delim ) ) {
    176176                        $content = explode( $delim[0], $content );
  • trunk/tests/phpunit/data/WPHTTP-testcase-redirection-script.php

    r47122 r55210  
    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 ) {
    … …  
    6464        echo $method;
    6565        exit;
    66        
     66
    6767}
    6868
  • trunk/tests/phpunit/tests/admin/includesFile.php

    r55031 r55210  
    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                );
    … …  
    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                );
    … …  
    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                );
    … …  
    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                );
    … …  
    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                );
    … …  
    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                );
  • trunk/tests/phpunit/tests/functions/doEnclose.php

    r55029 r55210  
    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                        ),
    … …  
    290290                return array(
    291291                        'headers' => array(
    292                                 'content-length' => 0,
    293                                 'content-type'   => '',
     292                                'Content-Length' => 0,
     293                                'Content-Type'   => '',
    294294                        ),
    295295                );
  • trunk/tests/phpunit/tests/http/base.php

    r54968 r55210  
    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.
  • trunk/tests/phpunit/tests/http/functions.php

    r54997 r55210  
    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        }
    … …  
    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        }
    … …  
    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        }
  • trunk/tests/phpunit/tests/post/wpAfterInsertPost.php

    r52010 r55210  
    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 );
    … …  
    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(
    … …  
    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 );
  • trunk/tests/phpunit/tests/rest-api/rest-autosaves-controller.php

    r55154 r55210  
    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(
    … …  
    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(
    … …  
    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(
    … …  
    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 );
    … …  
    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
    … …  
    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
    … …  
    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(
    … …  
    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(
    … …  
    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
    … …  
    700700                // Create autosaves response.
    701701                $request = new WP_REST_Request( 'POST', '/wp/v2/posts/' . $post_id . '/autosaves' );
    702                 $request->add_header( 'content-type', 'application/json' );
     702                $request->add_header( 'Content-Type', 'application/json' );
    703703                $request->set_body( wp_json_encode( $autosave_data ) );
    704704
  • trunk/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php

    r54402 r55210  
    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 );
  • trunk/tests/phpunit/tests/rest-api/rest-comments-controller.php

    r55104 r55210  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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 );
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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 );
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    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
    … …  
    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
    … …  
    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 );
    … …  
    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
    … …  
    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 );
    … …  
    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 );
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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 );
    … …  
    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 );
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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 );
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
  • trunk/tests/phpunit/tests/rest-api/rest-request.php

    r52235 r55210  
    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.
    … …  
    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         */
    … …  
    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        }
    … …  
    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
    … …  
    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
    … …  
    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(
    … …  
    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(
    … …  
    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(
    … …  
    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(
    … …  
    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(
    … …  
    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( '' );
  • trunk/tests/phpunit/tests/rest-api/rest-settings-controller.php

    r54131 r55210  
    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
  • trunk/tests/phpunit/tests/rest-api/rest-users-controller.php

    r55104 r55210  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    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
    … …  
    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 );
    … …  
    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 );
    … …  
    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 );
    … …  
    28932893
    28942894                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/users/%d', $user_id ) );
    2895                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     2895                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    28962896                $request->set_body_params( array( 'first_name' => 'New Name' ) );
    28972897                $response = rest_get_server()->dispatch( $request );
    … …  
    29152915
    29162916                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/users/%d', $user_id ) );
    2917                 $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
     2917                $request->add_header( 'Content-Type', 'application/x-www-form-urlencoded' );
    29182918                $request->set_body_params( array( 'first_name' => 'New Name' ) );
    29192919                $response = rest_get_server()->dispatch( $request );
  • trunk/tests/phpunit/tests/rest-api/rest-widgets-controller.php

    r54997 r55210  
    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                );
  • trunk/tests/phpunit/tests/rest-api/wpRestMenuItemsController.php

    r54896 r55210  
    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 );
    … …  
    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(
    … …  
    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(
    … …  
    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(
    … …  
    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(
    … …  
    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(
    … …  
    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(
    … …  
    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(
    … …  
    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(
    … …  
    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(
    … …  
    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(
    … …  
    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(
    … …  
    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(
    … …  
    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(
    … …  
    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(
    … …  
    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(
    … …  
    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(
    … …  
    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 );
    … …  
    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(
    … …  
    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(
  • trunk/tests/phpunit/tests/widgets/wpWidgetRss.php

    r54997 r55210  
    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                );
Note: See TracChangeset for help on using the changeset viewer.