WP_HTTP_Requests_Response::get_headers() WordPress Method
The get_headers() method in the WP_HTTP_Requests_Response class is used to get the HTTP headers from the response.
WP_HTTP_Requests_Response::get_headers() #
Retrieves headers associated with the response.
Return
(Requests_Utility_CaseInsensitiveDictionary) Map of header name to header value.
Source
File: wp-includes/class-wp-http-requests-response.php
public function get_headers() { // Ensure headers remain case-insensitive. $converted = new 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; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.6.0 | Introduced. |