WP_REST_Request::canonicalize_header_name

Advertisement

Summery Summery

Canonicalizes the header name.

Syntax Syntax

WP_REST_Request::canonicalize_header_name( string $key )

Description Description

Ensures that header names are always treated the same regardless of source. Header names are always case insensitive.

Note that we treat - (dashes) and _ (underscores) as the same character, as per header parsing rules in both Apache and nginx.

Parameters Parameters

$key

(Required) Header name.

Return Return

(string) Canonicalized name.

Source Source

File: wp-includes/rest-api/class-wp-rest-request.php

	public static function canonicalize_header_name( $key ) {
		$key = strtolower( $key );
		$key = str_replace( '-', '_', $key );

		return $key;
	}

Advertisement

Changelog Changelog

Changelog
Version Description
4.4.0 Introduced.

Advertisement

Leave a Reply