Make WordPress Core


Ignore:
Timestamp:
02/03/2023 01:33:18 PM (18 months 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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(
Note: See TracChangeset for help on using the changeset viewer.