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