WP_HTTP_Requests_Response::get_headers(): WpOrgRequestsUtilityCaseInsensitiveDictionary

Retrieves headers associated with the response.


Return

WpOrgRequestsUtilityCaseInsensitiveDictionary Map of header name to header value.


Top ↑

Source

File: wp-includes/class-wp-http-requests-response.php. View all references

public function get_headers() {
	// Ensure headers remain case-insensitive.
	$converted = new WpOrg\Requests\Utility\CaseInsensitiveDictionary();

	foreach ( $this->response->headers->getAll() as $key => $value ) {
		if ( count( $value ) === 1 ) {
			$converted[ $key ] = $value[0];
		} else {
			$converted[ $key ] = $value;
		}
	}

	return $converted;
}


Top ↑

Changelog

Changelog
Version Description
4.6.0 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.