mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-09 23:24:34 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@55210 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -203,7 +203,7 @@ class Tests_REST_Request extends WP_UnitTestCase {
|
||||
* @ticket 49404
|
||||
* @dataProvider alternate_json_content_type_provider
|
||||
*
|
||||
* @param string $content_type The content-type header.
|
||||
* @param string $content_type The Content-Type header.
|
||||
* @param string $source The source value.
|
||||
* @param bool $accept_json The accept_json value.
|
||||
*/
|
||||
@@ -234,7 +234,7 @@ class Tests_REST_Request extends WP_UnitTestCase {
|
||||
* @ticket 49404
|
||||
* @dataProvider is_json_content_type_provider
|
||||
*
|
||||
* @param string $content_type The content-type header.
|
||||
* @param string $content_type The Content-Type header.
|
||||
* @param bool $is_json The is_json value.
|
||||
*/
|
||||
public function test_is_json_content_type( $content_type, $is_json ) {
|
||||
@@ -242,7 +242,7 @@ class Tests_REST_Request extends WP_UnitTestCase {
|
||||
|
||||
$this->request->set_header( 'Content-Type', $content_type );
|
||||
|
||||
// Check for JSON content-type.
|
||||
// Check for JSON Content-Type.
|
||||
$this->assertSame( $is_json, $this->request->is_json_content_type() );
|
||||
}
|
||||
|
||||
@@ -361,7 +361,7 @@ class Tests_REST_Request extends WP_UnitTestCase {
|
||||
);
|
||||
|
||||
$this->request->set_method( 'PUT' );
|
||||
$this->request->add_header( 'content-type', 'application/json' );
|
||||
$this->request->add_header( 'Content-Type', 'application/json' );
|
||||
$this->request->set_body( wp_json_encode( $data ) );
|
||||
|
||||
foreach ( $data as $key => $expected_value ) {
|
||||
@@ -383,7 +383,7 @@ class Tests_REST_Request extends WP_UnitTestCase {
|
||||
);
|
||||
|
||||
$this->request->set_method( 'POST' );
|
||||
$this->request->add_header( 'content-type', 'application/json' );
|
||||
$this->request->add_header( 'Content-Type', 'application/json' );
|
||||
$this->request->set_body( wp_json_encode( $data ) );
|
||||
|
||||
foreach ( $data as $key => $expected_value ) {
|
||||
@@ -864,7 +864,7 @@ class Tests_REST_Request extends WP_UnitTestCase {
|
||||
|
||||
public function test_set_param_follows_parameter_order() {
|
||||
$request = new WP_REST_Request();
|
||||
$request->add_header( 'content-type', 'application/json' );
|
||||
$request->add_header( 'Content-Type', 'application/json' );
|
||||
$request->set_method( 'POST' );
|
||||
$request->set_body(
|
||||
wp_json_encode(
|
||||
@@ -892,7 +892,7 @@ class Tests_REST_Request extends WP_UnitTestCase {
|
||||
*/
|
||||
public function test_set_param_updates_param_in_json_and_query() {
|
||||
$request = new WP_REST_Request();
|
||||
$request->add_header( 'content-type', 'application/json' );
|
||||
$request->add_header( 'Content-Type', 'application/json' );
|
||||
$request->set_method( 'POST' );
|
||||
$request->set_body(
|
||||
wp_json_encode(
|
||||
@@ -919,7 +919,7 @@ class Tests_REST_Request extends WP_UnitTestCase {
|
||||
*/
|
||||
public function test_set_param_updates_param_if_already_exists_in_query() {
|
||||
$request = new WP_REST_Request();
|
||||
$request->add_header( 'content-type', 'application/json' );
|
||||
$request->add_header( 'Content-Type', 'application/json' );
|
||||
$request->set_method( 'POST' );
|
||||
$request->set_body(
|
||||
wp_json_encode(
|
||||
@@ -953,7 +953,7 @@ class Tests_REST_Request extends WP_UnitTestCase {
|
||||
*/
|
||||
public function test_set_param_to_null_updates_param_in_json_and_query() {
|
||||
$request = new WP_REST_Request();
|
||||
$request->add_header( 'content-type', 'application/json' );
|
||||
$request->add_header( 'Content-Type', 'application/json' );
|
||||
$request->set_method( 'POST' );
|
||||
$request->set_body(
|
||||
wp_json_encode(
|
||||
@@ -980,7 +980,7 @@ class Tests_REST_Request extends WP_UnitTestCase {
|
||||
*/
|
||||
public function test_set_param_from_null_updates_param_in_json_and_query_with_null() {
|
||||
$request = new WP_REST_Request();
|
||||
$request->add_header( 'content-type', 'application/json' );
|
||||
$request->add_header( 'Content-Type', 'application/json' );
|
||||
$request->set_method( 'POST' );
|
||||
$request->set_body(
|
||||
wp_json_encode(
|
||||
@@ -1007,7 +1007,7 @@ class Tests_REST_Request extends WP_UnitTestCase {
|
||||
*/
|
||||
public function test_set_param_with_invalid_json() {
|
||||
$request = new WP_REST_Request();
|
||||
$request->add_header( 'content-type', 'application/json' );
|
||||
$request->add_header( 'Content-Type', 'application/json' );
|
||||
$request->set_method( 'POST' );
|
||||
$request->set_body( '' );
|
||||
$request->set_param( 'param', 'value' );
|
||||
|
||||
Reference in New Issue
Block a user