WP_HTTP_Requests_Response::get_headers()
Retrieves headers associated with the response.
Method of the class: WP_HTTP_Requests_Response{}
No Hooks.
Return
\WpOrg\Requests\Utility\CaseInsensitiveDictionary
. Map of header name to header value.
Usage
$WP_HTTP_Requests_Response = new WP_HTTP_Requests_Response(); $WP_HTTP_Requests_Response->get_headers();
Changelog
Since 4.6.0 | Introduced. |
WP_HTTP_Requests_Response::get_headers() WP HTTP Requests Response::get headers code WP 6.4.3
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; }