WP_REST_Request::canonicalize_header_name( string $key )
Canonicalizes the header name.
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
- $key
-
(string) (Required) Header name.
Return
(string) Canonicalized name.
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; }
Changelog
Version | Description |
---|---|
4.4.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_request/canonicalize_header_name