TsgcHTTP2Client › Methods › Get
Performs a synchronous HTTP/2 GET and blocks until the full response has been received.
function Get(const aURL: string): string;
| Name | Type | Description |
|---|---|---|
aURL | const string | Absolute URL of the resource to fetch. Query-string parameters should already be encoded. |
Response body received from the server decoded as a string. (string)
Use this overload when the response is textual (HTML, JSON, XML) and fits comfortably in memory. The method blocks until all DATA frames have been received and returns the concatenated body.
vJSON := oClient.Get('https://api.example.com/v1/users');
procedure Get(Const aURL: string; const aResponseContent: TStream);
| Name | Type | Description |
|---|---|---|
aURL | const string | Absolute URL of the resource to fetch. |
aResponseContent | const TStream | Caller-owned stream that receives the raw response bytes as they arrive. |
Stream-oriented variant intended for binary downloads or large payloads where holding the body as a string is undesirable. The response is written sequentially into aResponseContent (for example a TFileStream).
oStream := TFileStream.Create('image.png', fmCreate);
try
oClient.Get('https://api.example.com/image.png', oStream);
finally
oStream.Free;
end;