TsgcHTTP2ClientMethods › PatchAsync

PatchAsync Method

Sends a non-blocking HTTP/2 PATCH; the reply is delivered asynchronously on OnHTTP2Response.

Syntax

procedure PatchAsync(const aURL: string; const aSource: TStream);

Parameters

NameTypeDescription
aURLconst stringAbsolute URL of the resource to be partially updated.
aSourceconst TStreamStream holding the patch document (for example a JSON Patch or JSON Merge Patch body).

Remarks

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.

Example

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;

Back to Methods