TsgcHTTP3Client › Methods › Head

Head Method

Sends a synchronous HTTP/3 HEAD request and returns the response object with the status and headers.

Syntax

function Head(const aURL: string): TsgcHTTP3Response;

Parameters

NameTypeDescription
aURLconst stringAbsolute URL of the resource whose headers are requested.

Return Value

The response object, exposing the status code and the response headers. (TsgcHTTP3Response)

Remarks

HEAD requests only the metadata of a resource: the server returns the status and headers but no body, exactly as it would for a Get on the same URL. Use it to check whether a resource exists, to read its content-length or content-type, or to test cache validators without transferring the payload.

The call blocks until the response has been received and returns a TsgcHTTP3Response whose StatusCode and Headers are populated. Unlike the other verbs, Head returns the response object itself rather than a string, and it has no asynchronous counterpart and no stream overload.

Example



oResponse := oClient.Head('https://api.example.com/v1/file.bin');

ShowMessage(IntToStr(oResponse.StatusCode));

ShowMessage(oResponse.Headers.Values['content-length']);

Back to Methods