Make WordPress Core


Ignore:
Timestamp:
02/03/2023 01:33:18 PM (13 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/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         */
Note: See TracChangeset for help on using the changeset viewer.