Changeset 55210
- Timestamp:
- 02/03/2023 01:33:18 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ajax-actions.php
r55111 r55210 2533 2533 /* 2534 2534 * 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. 2536 2536 * See https://core.trac.wordpress.org/ticket/31037 2537 2537 */ -
trunk/src/wp-admin/includes/file.php
r55204 r55210 1185 1185 } 1186 1186 1187 $content_disposition = wp_remote_retrieve_header( $response, ' content-disposition' );1187 $content_disposition = wp_remote_retrieve_header( $response, 'Content-Disposition' ); 1188 1188 1189 1189 if ( $content_disposition ) { … … 1212 1212 } 1213 1213 1214 $content_md5 = wp_remote_retrieve_header( $response, ' content-md5' );1214 $content_md5 = wp_remote_retrieve_header( $response, 'Content-MD5' ); 1215 1215 1216 1216 if ( $content_md5 ) { … … 1239 1239 // Perform signature valiation if supported. 1240 1240 if ( $signature_verification ) { 1241 $signature = wp_remote_retrieve_header( $response, ' x-content-signature' );1241 $signature = wp_remote_retrieve_header( $response, 'X-Content-Signature' ); 1242 1242 1243 1243 if ( ! $signature ) { -
trunk/src/wp-admin/includes/upgrade.php
r54891 r55210 513 513 */ 514 514 $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' ); 516 516 $pretty_permalinks = $x_pingback_header && get_bloginfo( 'pingback_url' ) === $x_pingback_header; 517 517 -
trunk/src/wp-includes/class-json.php
r54759 r55210 292 292 _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); 293 293 294 header('Content- type: application/json');294 header('Content-Type: application/json'); 295 295 return $this->encodeUnsafe($var); 296 296 } -
trunk/src/wp-includes/class-simplepie.php
r52413 r55210 1865 1865 1866 1866 /** 1867 * Send the content-type header with correct encoding1867 * Send the Content-Type header with correct encoding 1868 1868 * 1869 1869 * This method ensures that the SimplePie-enabled page is being served with … … 1887 1887 if (!headers_sent()) 1888 1888 { 1889 $header = "Content- type: $mime;";1889 $header = "Content-Type: $mime;"; 1890 1890 if ($this->get_encoding()) 1891 1891 { -
trunk/src/wp-includes/class-snoopy.php
r47735 r55210 54 54 // $cookies["username"]="joe"; 55 55 var $rawheaders = array(); // array of raw headers to send 56 // $rawheaders["Content- type"]="text/html";56 // $rawheaders["Content-Type"]="text/html"; 57 57 58 58 var $maxredirs = 5; // http redirection depth maximum. 0 = disallow … … 826 826 } 827 827 if(!empty($content_type)) { 828 $headers .= "Content- type: $content_type";828 $headers .= "Content-Type: $content_type"; 829 829 if ($content_type == "multipart/form-data") 830 830 $headers .= "; boundary=".$this->_mime_boundary; … … 832 832 } 833 833 if(!empty($body)) 834 $headers .= "Content- length: ".strlen($body)."\r\n";834 $headers .= "Content-Length: ".strlen($body)."\r\n"; 835 835 if(!empty($this->user) || !empty($this->pass)) 836 836 $headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n"; … … 991 991 if(!empty($content_type)) { 992 992 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; 994 994 else 995 $headers[] = "Content- type: $content_type";995 $headers[] = "Content-Type: $content_type"; 996 996 } 997 997 if(!empty($body)) 998 $headers[] = "Content- length: ".strlen($body);998 $headers[] = "Content-Length: ".strlen($body); 999 999 if(!empty($this->user) || !empty($this->pass)) 1000 1000 $headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass); -
trunk/src/wp-includes/comment.php
r54891 r55210 2825 2825 } 2826 2826 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' ); 2829 2829 } 2830 2830 2831 2831 // 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' ) ) ) { 2833 2833 return false; 2834 2834 } -
trunk/src/wp-includes/functions.php
r55117 r55210 944 944 $headers = wp_get_http_headers( $url ); 945 945 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'] : ''; 948 948 $allowed_types = array( 'video', 'audio' ); 949 949 -
trunk/src/wp-includes/general-template.php
r55094 r55210 756 756 * - 'charset' - The "Encoding for pages and feeds" (set in Settings > Reading) 757 757 * - 'version' - The current WordPress version 758 * - 'html_type' - The content-type (default: "text/html"). Themes and plugins758 * - 'html_type' - The Content-Type (default: "text/html"). Themes and plugins 759 759 * can override the default value using the {@see 'pre_option_html_type'} filter 760 760 * - 'text_direction' - The text direction determined by the site's language. is_rtl() -
trunk/src/wp-includes/pluggable.php
r55166 r55210 464 464 // Set Content-Type and charset. 465 465 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. 467 467 if ( ! isset( $content_type ) ) { 468 468 $content_type = 'text/plain'; -
trunk/src/wp-includes/rest-api/class-wp-rest-request.php
r54663 r55210 292 292 293 293 /** 294 * Retrieves the content-type of the request.294 * Retrieves the Content-Type of the request. 295 295 * 296 296 * @since 4.4.0 297 297 * 298 298 * @return array|null Map containing 'value' and 'parameters' keys 299 * or null when no valid content-type header was299 * or null when no valid Content-Type header was 300 300 * available. 301 301 */ 302 302 public function get_content_type() { 303 $value = $this->get_header( ' content-type' );303 $value = $this->get_header( 'Content-Type' ); 304 304 if ( empty( $value ) ) { 305 305 return null; … … 326 326 327 327 /** 328 * Checks if the request has specified a JSON content-type.328 * Checks if the request has specified a JSON Content-Type. 329 329 * 330 330 * @since 5.6.0 331 331 * 332 * @return bool True if the content-type header is JSON.332 * @return bool True if the Content-Type header is JSON. 333 333 */ 334 334 public function is_json_content_type() { … … 720 720 721 721 /* 722 * Check that we got URL-encoded. Treat a missing content-type as722 * Check that we got URL-encoded. Treat a missing Content-Type as 723 723 * URL-encoded for maximum compatibility. 724 724 */ -
trunk/src/wp-includes/sitemaps/class-wp-sitemaps-renderer.php
r54133 r55210 124 124 */ 125 125 public function render_index( $sitemaps ) { 126 header( 'Content- type: application/xml; charset=UTF-8' );126 header( 'Content-Type: application/xml; charset=UTF-8' ); 127 127 128 128 $this->check_for_simple_xml_availability(); … … 189 189 */ 190 190 public function render_sitemap( $url_list ) { 191 header( 'Content- type: application/xml; charset=UTF-8' );191 header( 'Content-Type: application/xml; charset=UTF-8' ); 192 192 193 193 $this->check_for_simple_xml_availability(); -
trunk/src/wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php
r54133 r55210 23 23 */ 24 24 public function render_stylesheet( $type ) { 25 header( 'Content- type: application/xml; charset=UTF-8' );25 header( 'Content-Type: application/xml; charset=UTF-8' ); 26 26 27 27 if ( 'sitemap' === $type ) { -
trunk/src/wp-mail.php
r55051 r55210 172 172 $content = $content[2]; 173 173 174 // Match case-insensitive content-transfer-encoding.174 // Match case-insensitive Content-Transfer-Encoding. 175 175 if ( preg_match( '/Content-Transfer-Encoding: quoted-printable/i', $content, $delim ) ) { 176 176 $content = explode( $delim[0], $content ); -
trunk/tests/phpunit/data/WPHTTP-testcase-redirection-script.php
r47122 r55210 37 37 if ( isset($_GET['header-check']) ) { 38 38 $out = array(); 39 header("Content- type: text/plain");39 header("Content-Type: text/plain"); 40 40 foreach ( $_SERVER as $key => $value ) { 41 41 if ( stripos($key, 'http') === 0 ) { … … 64 64 echo $method; 65 65 exit; 66 66 67 67 } 68 68 -
trunk/tests/phpunit/tests/admin/includesFile.php
r55031 r55210 157 157 ), 158 158 'headers' => array( 159 ' content-disposition' => 'attachment; filename="filename-from-content-disposition-header.txt"',159 'Content-Disposition' => 'attachment; filename="filename-from-content-disposition-header.txt"', 160 160 ), 161 161 ); … … 175 175 ), 176 176 'headers' => array( 177 ' content-disposition' => 'attachment; filename="../../filename-from-content-disposition-header.txt"',177 'Content-Disposition' => 'attachment; filename="../../filename-from-content-disposition-header.txt"', 178 178 ), 179 179 ); … … 193 193 ), 194 194 'headers' => array( 195 ' content-disposition' => 'attachment; filename=filename-from-content-disposition-header.txt',195 'Content-Disposition' => 'attachment; filename=filename-from-content-disposition-header.txt', 196 196 ), 197 197 ); … … 242 242 ), 243 243 'headers' => array( 244 ' content-disposition' => 'filename="filename-from-content-disposition-header.txt"',244 'Content-Disposition' => 'filename="filename-from-content-disposition-header.txt"', 245 245 ), 246 246 ); … … 260 260 ), 261 261 'headers' => array( 262 ' content-disposition' => 'inline; filename="filename-from-content-disposition-header.txt"',262 'Content-Disposition' => 'inline; filename="filename-from-content-disposition-header.txt"', 263 263 ), 264 264 ); … … 278 278 ), 279 279 '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"', 281 281 ), 282 282 ); -
trunk/tests/phpunit/tests/functions/doEnclose.php
r55029 r55210 266 266 'mp4' => array( 267 267 'headers' => array( 268 ' content-length' => 123,269 ' content-type' => 'video/mp4',268 'Content-Length' => 123, 269 'Content-Type' => 'video/mp4', 270 270 ), 271 271 ), … … 290 290 return array( 291 291 'headers' => array( 292 ' content-length' => 0,293 ' content-type' => '',292 'Content-Length' => 0, 293 'Content-Type' => '', 294 294 ), 295 295 ); -
trunk/tests/phpunit/tests/http/base.php
r54968 r55210 284 284 $this->assertNotWPError( $res ); 285 285 $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). 287 287 $this->assertSame( $size, $filesize ); // Check that the file is written to disk correctly without any extra characters. 288 288 $this->assertStringStartsWith( get_temp_dir(), $res['filename'] ); // Check it's saving within the temp directory. -
trunk/tests/phpunit/tests/http/functions.php
r54997 r55210 21 21 $this->assertIsArray( $response ); 22 22 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'] ); 25 25 $this->assertSame( 200, wp_remote_retrieve_response_code( $response ) ); 26 26 } … … 66 66 67 67 // 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'] ); 70 70 $this->assertSame( 200, wp_remote_retrieve_response_code( $response ) ); 71 71 } … … 87 87 88 88 // 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'] ); 91 91 $this->assertSame( 200, wp_remote_retrieve_response_code( $response ) ); 92 92 } -
trunk/tests/phpunit/tests/post/wpAfterInsertPost.php
r52010 r55210 172 172 173 173 $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' ); 175 175 $request->set_body_params( array( 'title' => 'new title' ) ); 176 176 rest_get_server()->dispatch( $request ); … … 189 189 190 190 $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' ); 192 192 $request->set_body_params( 193 193 array( … … 212 212 213 213 $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' ); 215 215 $request->set_body_params( array( 'title' => 'new attachment title' ) ); 216 216 rest_get_server()->dispatch( $request ); -
trunk/tests/phpunit/tests/rest-api/rest-autosaves-controller.php
r55154 r55210 312 312 313 313 $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' ); 315 315 316 316 $params = $this->set_post_data( … … 328 328 wp_set_current_user( self::$editor_id ); 329 329 $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' ); 331 331 332 332 $params = $this->set_post_data( … … 347 347 348 348 $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' ); 350 350 351 351 $params = $this->set_post_data( … … 366 366 367 367 $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' ); 369 369 370 370 $current_post = get_post( self::$post_id ); … … 413 413 414 414 $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' ); 416 416 $request->set_body( wp_json_encode( $autosave_data ) ); 417 417 … … 452 452 453 453 $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' ); 455 455 $request->set_body( wp_json_encode( $autosave_data ) ); 456 456 … … 573 573 wp_set_current_user( self::$editor_id ); 574 574 $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' ); 576 576 577 577 $params = $this->set_post_data( … … 594 594 595 595 $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' ); 597 597 598 598 $params = $this->set_post_data( … … 649 649 // Initiate an autosave via the REST API as Gutenberg does. 650 650 $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' ); 652 652 $request->set_body( wp_json_encode( $autosave_data ) ); 653 653 … … 700 700 // Create autosaves response. 701 701 $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' ); 703 703 $request->set_body( wp_json_encode( $autosave_data ) ); 704 704 -
trunk/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php
r54402 r55210 502 502 $request = new WP_REST_Request( 'POST', self::$rest_api_route . self::$block_name ); 503 503 $request->set_param( 'context', 'edit' ); 504 $request->set_header( ' content-type', 'application/json' );504 $request->set_header( 'Content-Type', 'application/json' ); 505 505 $request->set_body( wp_json_encode( compact( 'attributes' ) ) ); 506 506 $response = rest_get_server()->dispatch( $request ); -
trunk/tests/phpunit/tests/rest-api/rest-comments-controller.php
r55104 r55210 1134 1134 1135 1135 $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' ); 1137 1137 $request->set_body( wp_json_encode( $params ) ); 1138 1138 … … 1240 1240 1241 1241 $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' ); 1243 1243 $request->set_body( wp_json_encode( $params ) ); 1244 1244 … … 1265 1265 1266 1266 $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' ); 1268 1268 $request->set_body( wp_json_encode( $params ) ); 1269 1269 … … 1288 1288 1289 1289 $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' ); 1291 1291 $request->set_body( wp_json_encode( $params ) ); 1292 1292 … … 1308 1308 1309 1309 $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' ); 1311 1311 $request->set_body( wp_json_encode( $params ) ); 1312 1312 … … 1328 1328 1329 1329 $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' ); 1331 1331 $request->set_body( wp_json_encode( $params ) ); 1332 1332 … … 1348 1348 1349 1349 $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' ); 1351 1351 $request->set_body( wp_json_encode( $params ) ); 1352 1352 … … 1366 1366 1367 1367 $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' ); 1369 1369 $request->set_body( wp_json_encode( $params ) ); 1370 1370 $response = rest_get_server()->dispatch( $request ); … … 1387 1387 1388 1388 $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' ); 1390 1390 $request->set_body( wp_json_encode( $params ) ); 1391 1391 … … 1414 1414 1415 1415 $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' ); 1417 1417 $request->set_body( wp_json_encode( $params ) ); 1418 1418 … … 1436 1436 1437 1437 $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' ); 1439 1439 $request->set_body( wp_json_encode( $params ) ); 1440 1440 … … 1461 1461 1462 1462 $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' ); 1464 1464 $request->set_body( wp_json_encode( $params ) ); 1465 1465 … … 1482 1482 1483 1483 $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' ); 1485 1485 $request->set_body( wp_json_encode( $params ) ); 1486 1486 … … 1511 1511 1512 1512 $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' ); 1514 1514 $request->set_body( wp_json_encode( $params ) ); 1515 1515 $response = rest_get_server()->dispatch( $request ); … … 1537 1537 1538 1538 $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' ); 1540 1540 $request->set_body( wp_json_encode( $params ) ); 1541 1541 … … 1576 1576 1577 1577 $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' ); 1579 1579 $request->set_body( wp_json_encode( $params ) ); 1580 1580 … … 1599 1599 1600 1600 $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' ); 1602 1602 $request->set_body( wp_json_encode( $params ) ); 1603 1603 … … 1626 1626 1627 1627 $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' ); 1629 1629 $request->set_body( wp_json_encode( $params ) ); 1630 1630 $response = rest_get_server()->dispatch( $request ); … … 1655 1655 1656 1656 $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' ); 1658 1658 $request->set_body( wp_json_encode( $params ) ); 1659 1659 $response = rest_get_server()->dispatch( $request ); … … 1680 1680 1681 1681 $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' ); 1683 1683 $request->set_body( wp_json_encode( $params ) ); 1684 1684 $response = rest_get_server()->dispatch( $request ); … … 1700 1700 1701 1701 $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' ); 1703 1703 $request->set_body( wp_json_encode( $params ) ); 1704 1704 $response = rest_get_server()->dispatch( $request ); … … 1721 1721 1722 1722 $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' ); 1724 1724 $request->set_body( wp_json_encode( $params ) ); 1725 1725 $response = rest_get_server()->dispatch( $request ); … … 1745 1745 1746 1746 $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' ); 1748 1748 $request->set_body( wp_json_encode( $params ) ); 1749 1749 … … 1769 1769 1770 1770 $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)' ); 1773 1773 $request->set_body( wp_json_encode( $params ) ); 1774 1774 … … 1795 1795 ); 1796 1796 $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' ); 1798 1798 $request->set_body( wp_json_encode( $params ) ); 1799 1799 $response = rest_get_server()->dispatch( $request ); … … 1816 1816 ); 1817 1817 $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' ); 1819 1819 $request->set_body( wp_json_encode( $params ) ); 1820 1820 … … 1836 1836 1837 1837 $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' ); 1839 1839 $request->set_body( wp_json_encode( $params ) ); 1840 1840 $response = rest_get_server()->dispatch( $request ); … … 1856 1856 1857 1857 $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' ); 1859 1859 $request->set_body( wp_json_encode( $params ) ); 1860 1860 $response = rest_get_server()->dispatch( $request ); … … 1876 1876 1877 1877 $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' ); 1879 1879 $request->set_body( wp_json_encode( $params ) ); 1880 1880 … … 1896 1896 1897 1897 $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' ); 1899 1899 $request->set_body( wp_json_encode( $params ) ); 1900 1900 … … 1916 1916 1917 1917 $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' ); 1919 1919 $request->set_body( wp_json_encode( $params ) ); 1920 1920 … … 1936 1936 1937 1937 $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' ); 1939 1939 $request->set_body( wp_json_encode( $params ) ); 1940 1940 … … 1956 1956 1957 1957 $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' ); 1959 1959 $request->set_body( wp_json_encode( $params ) ); 1960 1960 … … 1977 1977 1978 1978 $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' ); 1980 1980 $request->set_body( wp_json_encode( $params ) ); 1981 1981 … … 1997 1997 1998 1998 $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' ); 2000 2000 $request->set_body( wp_json_encode( $params ) ); 2001 2001 … … 2024 2024 2025 2025 $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' ); 2027 2027 $request->set_body( wp_json_encode( $params ) ); 2028 2028 $response = rest_get_server()->dispatch( $request ); … … 2045 2045 2046 2046 $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' ); 2048 2048 $request->set_body( wp_json_encode( $params ) ); 2049 2049 $response = rest_get_server()->dispatch( $request ); … … 2076 2076 2077 2077 $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' ); 2079 2079 $request->set_body( wp_json_encode( $params ) ); 2080 2080 … … 2094 2094 2095 2095 $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' ); 2097 2097 $request->set_body( wp_json_encode( $params ) ); 2098 2098 … … 2118 2118 2119 2119 $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' ); 2121 2121 $request->set_body( wp_json_encode( $params ) ); 2122 2122 … … 2133 2133 2134 2134 $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' ); 2136 2136 $request->set_body( wp_json_encode( $params ) ); 2137 2137 … … 2157 2157 2158 2158 $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' ); 2160 2160 $request->set_body( wp_json_encode( $params ) ); 2161 2161 … … 2184 2184 $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); 2185 2185 2186 $request->add_header( ' content-type', 'application/json' );2186 $request->add_header( 'Content-Type', 'application/json' ); 2187 2187 $request->set_body( wp_json_encode( $params ) ); 2188 2188 $response = rest_get_server()->dispatch( $request ); … … 2208 2208 $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); 2209 2209 2210 $request->add_header( ' content-type', 'application/json' );2210 $request->add_header( 'Content-Type', 'application/json' ); 2211 2211 $request->set_body( wp_json_encode( $params ) ); 2212 2212 $response = rest_get_server()->dispatch( $request ); … … 2232 2232 $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); 2233 2233 2234 $request->add_header( ' content-type', 'application/json' );2234 $request->add_header( 'Content-Type', 'application/json' ); 2235 2235 $request->set_body( wp_json_encode( $params ) ); 2236 2236 $response = rest_get_server()->dispatch( $request ); … … 2256 2256 $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); 2257 2257 2258 $request->add_header( ' content-type', 'application/json' );2258 $request->add_header( 'Content-Type', 'application/json' ); 2259 2259 $request->set_body( wp_json_encode( $params ) ); 2260 2260 $response = rest_get_server()->dispatch( $request ); … … 2276 2276 $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); 2277 2277 2278 $request->add_header( ' content-type', 'application/json' );2278 $request->add_header( 'Content-Type', 'application/json' ); 2279 2279 $request->set_body( wp_json_encode( $params ) ); 2280 2280 $response = rest_get_server()->dispatch( $request ); … … 2297 2297 $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); 2298 2298 2299 $request->add_header( ' content-type', 'application/json' );2299 $request->add_header( 'Content-Type', 'application/json' ); 2300 2300 $request->set_body( wp_json_encode( $params ) ); 2301 2301 $response = rest_get_server()->dispatch( $request ); … … 2320 2320 2321 2321 $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' ); 2323 2323 $request->set_body( wp_json_encode( $params ) ); 2324 2324 … … 2425 2425 2426 2426 $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' ); 2428 2428 $request->set_body( wp_json_encode( $params ) ); 2429 2429 … … 2453 2453 2454 2454 $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' ); 2456 2456 $request->set_body( wp_json_encode( $params ) ); 2457 2457 … … 2475 2475 2476 2476 $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' ); 2478 2478 $request->set_body( wp_json_encode( $params ) ); 2479 2479 … … 2499 2499 2500 2500 $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' ); 2502 2502 $request->set_body( wp_json_encode( $params ) ); 2503 2503 … … 2519 2519 2520 2520 $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' ); 2522 2522 $request->set_body( wp_json_encode( $params ) ); 2523 2523 … … 2538 2538 2539 2539 $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' ); 2541 2541 $request->set_body( wp_json_encode( $params ) ); 2542 2542 … … 2558 2558 2559 2559 $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' ); 2561 2561 $request->set_body( wp_json_encode( $params ) ); 2562 2562 … … 2576 2576 2577 2577 $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' ); 2579 2579 $request->set_body( wp_json_encode( $params ) ); 2580 2580 $response = rest_get_server()->dispatch( $request ); … … 2593 2593 2594 2594 $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' ); 2596 2596 $request->set_body( wp_json_encode( $params ) ); 2597 2597 … … 2610 2610 2611 2611 $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' ); 2613 2613 $request->set_body( wp_json_encode( $params ) ); 2614 2614 … … 2631 2631 2632 2632 $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' ); 2634 2634 $request->set_body( wp_json_encode( $params ) ); 2635 2635 … … 2647 2647 2648 2648 $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' ); 2650 2650 $request->set_body( wp_json_encode( $params ) ); 2651 2651 … … 2662 2662 2663 2663 $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' ); 2665 2665 $request->set_body( wp_json_encode( $params ) ); 2666 2666 … … 2687 2687 2688 2688 $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' ); 2690 2690 $request->set_body( wp_json_encode( $params ) ); 2691 2691 … … 2706 2706 2707 2707 $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' ); 2709 2709 $request->set_body( wp_json_encode( $params ) ); 2710 2710 … … 2736 2736 2737 2737 $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' ); 2739 2739 $request->set_body( wp_json_encode( $params ) ); 2740 2740 … … 2795 2795 $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); 2796 2796 2797 $request->add_header( ' content-type', 'application/json' );2797 $request->add_header( 'Content-Type', 'application/json' ); 2798 2798 $request->set_body( wp_json_encode( $params ) ); 2799 2799 $response = rest_get_server()->dispatch( $request ); … … 2815 2815 $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); 2816 2816 2817 $request->add_header( ' content-type', 'application/json' );2817 $request->add_header( 'Content-Type', 'application/json' ); 2818 2818 $request->set_body( wp_json_encode( $params ) ); 2819 2819 $response = rest_get_server()->dispatch( $request ); … … 2835 2835 $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); 2836 2836 2837 $request->add_header( ' content-type', 'application/json' );2837 $request->add_header( 'Content-Type', 'application/json' ); 2838 2838 $request->set_body( wp_json_encode( $params ) ); 2839 2839 $response = rest_get_server()->dispatch( $request ); … … 2854 2854 $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); 2855 2855 2856 $request->add_header( ' content-type', 'application/json' );2856 $request->add_header( 'Content-Type', 'application/json' ); 2857 2857 $request->set_body( wp_json_encode( $params ) ); 2858 2858 $response = rest_get_server()->dispatch( $request ); … … 2875 2875 $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); 2876 2876 2877 $request->add_header( ' content-type', 'application/json' );2877 $request->add_header( 'Content-Type', 'application/json' ); 2878 2878 $request->set_body( wp_json_encode( $params ) ); 2879 2879 $response = rest_get_server()->dispatch( $request ); -
trunk/tests/phpunit/tests/rest-api/rest-request.php
r52235 r55210 204 204 * @dataProvider alternate_json_content_type_provider 205 205 * 206 * @param string $content_type The content-type header.206 * @param string $content_type The Content-Type header. 207 207 * @param string $source The source value. 208 208 * @param bool $accept_json The accept_json value. … … 235 235 * @dataProvider is_json_content_type_provider 236 236 * 237 * @param string $content_type The content-type header.237 * @param string $content_type The Content-Type header. 238 238 * @param bool $is_json The is_json value. 239 239 */ … … 243 243 $this->request->set_header( 'Content-Type', $content_type ); 244 244 245 // Check for JSON content-type.245 // Check for JSON Content-Type. 246 246 $this->assertSame( $is_json, $this->request->is_json_content_type() ); 247 247 } … … 362 362 363 363 $this->request->set_method( 'PUT' ); 364 $this->request->add_header( ' content-type', 'application/json' );364 $this->request->add_header( 'Content-Type', 'application/json' ); 365 365 $this->request->set_body( wp_json_encode( $data ) ); 366 366 … … 384 384 385 385 $this->request->set_method( 'POST' ); 386 $this->request->add_header( ' content-type', 'application/json' );386 $this->request->add_header( 'Content-Type', 'application/json' ); 387 387 $this->request->set_body( wp_json_encode( $data ) ); 388 388 … … 865 865 public function test_set_param_follows_parameter_order() { 866 866 $request = new WP_REST_Request(); 867 $request->add_header( ' content-type', 'application/json' );867 $request->add_header( 'Content-Type', 'application/json' ); 868 868 $request->set_method( 'POST' ); 869 869 $request->set_body( … … 893 893 public function test_set_param_updates_param_in_json_and_query() { 894 894 $request = new WP_REST_Request(); 895 $request->add_header( ' content-type', 'application/json' );895 $request->add_header( 'Content-Type', 'application/json' ); 896 896 $request->set_method( 'POST' ); 897 897 $request->set_body( … … 920 920 public function test_set_param_updates_param_if_already_exists_in_query() { 921 921 $request = new WP_REST_Request(); 922 $request->add_header( ' content-type', 'application/json' );922 $request->add_header( 'Content-Type', 'application/json' ); 923 923 $request->set_method( 'POST' ); 924 924 $request->set_body( … … 954 954 public function test_set_param_to_null_updates_param_in_json_and_query() { 955 955 $request = new WP_REST_Request(); 956 $request->add_header( ' content-type', 'application/json' );956 $request->add_header( 'Content-Type', 'application/json' ); 957 957 $request->set_method( 'POST' ); 958 958 $request->set_body( … … 981 981 public function test_set_param_from_null_updates_param_in_json_and_query_with_null() { 982 982 $request = new WP_REST_Request(); 983 $request->add_header( ' content-type', 'application/json' );983 $request->add_header( 'Content-Type', 'application/json' ); 984 984 $request->set_method( 'POST' ); 985 985 $request->set_body( … … 1008 1008 public function test_set_param_with_invalid_json() { 1009 1009 $request = new WP_REST_Request(); 1010 $request->add_header( ' content-type', 'application/json' );1010 $request->add_header( 'Content-Type', 'application/json' ); 1011 1011 $request->set_method( 'POST' ); 1012 1012 $request->set_body( '' ); -
trunk/tests/phpunit/tests/rest-api/rest-settings-controller.php
r54131 r55210 774 774 ); 775 775 $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' ); 777 777 $request->set_body( wp_json_encode( $data ) ); 778 778 -
trunk/tests/phpunit/tests/rest-api/rest-users-controller.php
r55104 r55210 1231 1231 1232 1232 $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' ); 1234 1234 $request->set_body_params( $params ); 1235 1235 $response = rest_get_server()->dispatch( $request ); … … 1264 1264 1265 1265 $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' ); 1267 1267 $request->set_body_params( $params ); 1268 1268 $response = rest_get_server()->dispatch( $request ); … … 1309 1309 1310 1310 $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' ); 1312 1312 $request->set_body_params( $params ); 1313 1313 $response = rest_get_server()->dispatch( $request ); … … 1339 1339 1340 1340 $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' ); 1342 1342 $request->set_body_params( $params ); 1343 1343 $response = rest_get_server()->dispatch( $request ); … … 1370 1370 1371 1371 $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' ); 1373 1373 $request->set_body_params( $params ); 1374 1374 $response = rest_get_server()->dispatch( $request ); … … 1393 1393 1394 1394 $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' ); 1396 1396 $request->set_body_params( $params ); 1397 1397 $response = rest_get_server()->dispatch( $request ); … … 1423 1423 1424 1424 $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' ); 1426 1426 $request->set_body_params( $params ); 1427 1427 $response = rest_get_server()->dispatch( $request ); … … 1432 1432 1433 1433 $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' ); 1435 1435 $request->set_body_params( $params ); 1436 1436 $switched_response = rest_get_server()->dispatch( $request ); … … 1471 1471 1472 1472 $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' ); 1474 1474 $request->set_body( wp_json_encode( $params ) ); 1475 1475 $response = rest_get_server()->dispatch( $request ); … … 1488 1488 1489 1489 $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' ); 1491 1491 $request->set_body_params( $params ); 1492 1492 $response = rest_get_server()->dispatch( $request ); … … 1508 1508 1509 1509 $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' ); 1511 1511 $request->set_body_params( $params ); 1512 1512 $response = rest_get_server()->dispatch( $request ); … … 1527 1527 1528 1528 $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' ); 1530 1530 $request->set_body_params( $params ); 1531 1531 $response = rest_get_server()->dispatch( $request ); … … 1547 1547 1548 1548 $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' ); 1550 1550 $request->set_body_params( $params ); 1551 1551 $response = rest_get_server()->dispatch( $request ); … … 1580 1580 1581 1581 $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' ); 1583 1583 $request->set_body_params( $_POST ); 1584 1584 $response = rest_get_server()->dispatch( $request ); … … 1827 1827 1828 1828 $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' ); 1830 1830 $request->set_body( wp_json_encode( $params ) ); 1831 1831 … … 2009 2009 2010 2010 $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' ); 2012 2012 $request->set_body_params( $params ); 2013 2013 $response = rest_get_server()->dispatch( $request ); … … 2016 2016 2017 2017 $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' ); 2019 2019 $request->set_body_params( $params ); 2020 2020 $response = rest_get_server()->dispatch( $request ); … … 2036 2036 2037 2037 $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' ); 2039 2039 $request->set_body_params( $params ); 2040 2040 $response = rest_get_server()->dispatch( $request ); … … 2893 2893 2894 2894 $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' ); 2896 2896 $request->set_body_params( array( 'first_name' => 'New Name' ) ); 2897 2897 $response = rest_get_server()->dispatch( $request ); … … 2915 2915 2916 2916 $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' ); 2918 2918 $request->set_body_params( array( 'first_name' => 'New Name' ) ); 2919 2919 $response = rest_get_server()->dispatch( $request ); -
trunk/tests/phpunit/tests/rest-api/rest-widgets-controller.php
r54997 r55210 413 413 public function mocked_rss_response() { 414 414 $single_value_headers = array( 415 ' content-type' => 'application/rss+xml; charset=UTF-8',415 'Content-Type' => 'application/rss+xml; charset=UTF-8', 416 416 'link' => '<https://wordpress.org/news/wp-json/>; rel="https://api.w.org/"', 417 417 ); -
trunk/tests/phpunit/tests/rest-api/wpRestMenuItemsController.php
r54896 r55210 319 319 320 320 $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' ); 322 322 $params = $this->set_menu_item_data(); 323 323 $request->set_body_params( $params ); … … 335 335 336 336 $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' ); 338 338 $params = $this->set_menu_item_data( 339 339 array( … … 355 355 356 356 $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' ); 358 358 $params = $this->set_menu_item_data( 359 359 array( … … 378 378 for ( $i = 1; $i < 5; $i++ ) { 379 379 $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' ); 381 381 $params = $this->set_menu_item_data( 382 382 array( … … 405 405 406 406 $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' ); 408 408 $params = $this->set_menu_item_data( 409 409 array( … … 417 417 418 418 $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' ); 420 420 $params = $this->set_menu_item_data( 421 421 array( … … 437 437 $new_menu_id = wp_create_nav_menu( rand_str() ); 438 438 $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' ); 440 440 $params = $this->set_menu_item_data( 441 441 array( … … 457 457 $new_menu_id = wp_create_nav_menu( rand_str() ); 458 458 $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' ); 460 460 $params = $this->set_menu_item_data( 461 461 array( … … 477 477 wp_create_nav_menu( rand_str() ); 478 478 $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' ); 480 480 $params = $this->set_menu_item_data( 481 481 array( … … 495 495 wp_set_current_user( self::$admin_id ); 496 496 $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' ); 498 498 $params = $this->set_menu_item_data( 499 499 array( … … 514 514 515 515 $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' ); 517 517 $params = $this->set_menu_item_data( 518 518 array( … … 534 534 535 535 $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' ); 537 537 $params = $this->set_menu_item_data( 538 538 array( … … 554 554 555 555 $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' ); 557 557 $params = $this->set_menu_item_data( 558 558 array( … … 574 574 575 575 $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' ); 577 577 $params = $this->set_menu_item_data( 578 578 array( … … 594 594 595 595 $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' ); 597 597 $params = $this->set_menu_item_data( 598 598 array( … … 616 616 617 617 $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' ); 619 619 $params = $this->set_menu_item_data( 620 620 array( … … 649 649 650 650 $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' ); 652 652 $params = $this->set_menu_item_data( 653 653 array( … … 681 681 682 682 $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' ); 684 684 $params = $this->set_menu_item_data(); 685 685 $request->set_body_params( $params ); … … 1022 1022 1023 1023 $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' ); 1025 1025 $parameters = $this->set_menu_item_data( 1026 1026 array( … … 1044 1044 1045 1045 $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' ); 1047 1047 $title = 'Some \\\'title'; 1048 1048 $params = $this->set_menu_item_data( -
trunk/tests/phpunit/tests/widgets/wpWidgetRss.php
r54997 r55210 102 102 public function mocked_rss_response() { 103 103 $single_value_headers = array( 104 ' content-type' => 'application/rss+xml; charset=UTF-8',104 'Content-Type' => 'application/rss+xml; charset=UTF-8', 105 105 'link' => '<https://wordpress.org/news/wp-json/>; rel="https://api.w.org/"', 106 106 );
Note: See TracChangeset
for help on using the changeset viewer.