WP_HTTP_Requests_Response::get_headers()
Retrieves headers associated with the response.
Метод класса: WP_HTTP_Requests_Response{}
Хуков нет.
Возвращает
\WpOrg\Requests\Utility\CaseInsensitiveDictionary
. Map of header name to header value.
Использование
$WP_HTTP_Requests_Response = new WP_HTTP_Requests_Response(); $WP_HTTP_Requests_Response->get_headers();
Список изменений
С версии 4.6.0 | Введена. |
Код WP_HTTP_Requests_Response::get_headers() WP HTTP Requests Response::get headers WP 6.6.2
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; }