TsgcHTTP2Client › Methods › PutAsync
Sends a non-blocking HTTP/2 PUT; the server's reply is delivered on OnHTTP2Response.
procedure PutAsync(const aURL: string; const aSource: TStream);
| Name | Type | Description |
|---|---|---|
aURL | const string | Absolute URL identifying the resource that will be created or replaced. |
aSource | const TStream | Stream supplying the full representation of the resource to store. |
Non-blocking variant of Put. The call returns as soon as the stream has been serialised into HTTP/2 DATA frames; confirmation (status code, headers and body) is handed back later on OnHTTP2Response. Useful in UI-driven code paths that must not freeze.
oClient.OnHTTP2Response := OnHTTP2ResponseEvent;
oBody := TStringStream.Create('{"status":"active"}');
try
oClient.Request.ContentType := 'application/json';
oClient.PutAsync('https://api.example.com/users/42', oBody);
finally
oBody.Free;
end;