TsgcHTTP3Client › Methods › QueryAsync

QueryAsync Method

Sends a non-blocking HTTP/3 QUERY request; the reply arrives on OnResponse.

Syntax

procedure QueryAsync(const aURL: string; const aData: string;

  const aContentType: string = 'application/x-www-form-urlencoded');

Parameters

NameTypeDescription
aURLconst stringAbsolute URL of the target resource.
aDataconst stringRequest body. It is encoded as UTF-8 before being sent.
aContentTypeconst stringValue of the content-type request header. Defaults to application/x-www-form-urlencoded.

Return Value

None. The response is delivered on OnResponse.

Remarks

The request runs on a background thread and the method returns immediately. The reply is delivered on OnResponse, and a failure is reported on OnError.

QUERY is the IETF HTTP QUERY method: a safe, idempotent request that carries a body, suited to search and filter payloads that do not fit a query string.

The synchronous counterpart is Query, which blocks and returns the body directly.

The events fire on the background worker thread that carried out the request, not on the main thread. Synchronise before touching VCL or FMX controls from the handler.

Example



oClient.OnResponse := OnResponseEvent;

oClient.QueryAsync('https://api.example.com/v1/items', '{}');

Back to Methods