GC_HTTP_Requests_Response::get_headers()
最后更新于:2021-12-01 11:11:45
GC_()Retrieves headers associated with the response.
响应
(Requests_Utility_CaseInsensitiveDictionary) Map of header name to header value.
源文件
文件: gc-includes/class-gc-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;
}