TsgcHTTP2Client方法 › Head

Head 方法

执行同步 HTTP/2 HEAD 请求,仅返回响应头而不返回任何正文。

语法

procedure Head(const aURL: string);

参数

名称类型描述
aURLconst string需要获取元数据(状态、大小、内容类型、缓存验证器)的资源的绝对 URL。

备注

HEAD 与 GET 相同,但服务器不得返回消息正文。它适用于检查资源是否存在、读取 content-lengthlast-modified,或在无需完整下载成本的情况下验证缓存条目。调用返回后,响应头可通过 Request.Headers 获取。

示例

oClient.Head('https://api.example.com/download/large.bin');
vSize := oClient.Request.Headers.Values['content-length'];

返回方法