TsgcHTTP2Client › Methods › PatchAsync
Sends a non-blocking HTTP/2 PATCH; the reply is delivered asynchronously on OnHTTP2Response.
procedure PatchAsync(const aURL: string; const aSource: TStream);
| Name | Type | Description |
|---|---|---|
aURL | const string | Absolute URL of the resource to be partially updated. |
aSource | const TStream | Stream holding the patch document (for example a JSON Patch or JSON Merge Patch body). |
Non-blocking variant of Patch. Queues the request for delivery and returns immediately; the server response reaches the application via OnHTTP2Response. Remember to set Request.ContentType to a valid patch media type before the call.
oClient.OnHTTP2Response := OnHTTP2ResponseEvent;
oBody := TStringStream.Create('{"email":"new@example.com"}');
try
oClient.Request.ContentType := 'application/merge-patch+json';
oClient.PatchAsync('https://api.example.com/users/42', oBody);
finally
oBody.Free;
end;