WP_Http_Encoding::should_decode()public staticWP 2.8.0

Whether the content be decoded based on the headers.

Method of the class: WP_Http_Encoding{}

No Hooks.

Return

true|false.

Usage

$result = WP_Http_Encoding::should_decode( $headers );
$headers(array|string) (required)
All of the available headers.

Changelog

Since 2.8.0 Introduced.

WP_Http_Encoding::should_decode() code WP 6.4.3

public static function should_decode( $headers ) {
	if ( is_array( $headers ) ) {
		if ( array_key_exists( 'content-encoding', $headers ) && ! empty( $headers['content-encoding'] ) ) {
			return true;
		}
	} elseif ( is_string( $headers ) ) {
		return ( stripos( $headers, 'content-encoding:' ) !== false );
	}

	return false;
}