TsgcHTTP3Client › Methods › PutAsync
Sends a non-blocking HTTP/3 PUT request; the reply arrives on OnResponse.
procedure PutAsync(const aURL: string; const aData: string;
const aContentType: string = 'application/json');
| Name | Type | Description |
|---|---|---|
aURL | const string | Absolute URL of the target resource. |
aData | const string | Request body. It is encoded as UTF-8 before being sent. |
aContentType | const string | Value of the content-type request header. Defaults to application/json. |
None. The response is delivered on OnResponse.
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.
PUT replaces the target resource with the supplied representation.
The synchronous counterpart is Put, 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.
oClient.OnResponse := OnResponseEvent;
oClient.PutAsync('https://api.example.com/v1/items', '{}');