WordPress at a glance
function is not described

WP_REST_Request::canonicalize_header_name() public WP 4.4.0

Canonicalizes the header name.

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.

It's a method of the class: WP_REST_Request{}

No Hooks.

Return

String. Canonicalized name.

Usage

$result = WP_REST_Request::canonicalize_header_name( $key );
$key(string) (required)
Header name.

Changelog

Since 4.4.0 Introduced.

Code of WP_REST_Request::canonicalize_header_name() WP 5.5.1

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

	return $key;
}