Patch
procedure Patch(const aURL: string);
Example
procedure ScriptEvent(var Value: variant);
begin
Http.ContentAsUTF8 := '{"status":"ready"}';
Http.Header['Content-Type'] := 'application/merge-patch+json';
Http.Header['If-Match'] := '"example-version"';
Http.Patch('https://api.example.invalid/resources/example-123');
Value := Http.Response.ResponseCode;
end;
Usage
Sends a synchronous PATCH request with the complete nonempty pending body and captures the response through the shared HTTP pipeline.
Additional Technical Info
Patch selects hmPatch, stores aURL, and synchronously invokes Indy's PATCH overload. If the pending Content size is positive, Indy sends the complete stream from position zero; otherwise Velox passes no source stream.
Velox does not select a patch document format, set Content-Type, add If-Match, determine whether the server supports PATCH or verify that the modification was applied. Those are endpoint-contract responsibilities. Use the exact media type and precondition expected by the service; PATCH is not inherently idempotent.
The pending body is normally cleared in finally, including after operational request failures, and must be loaded again for a retry. An authentication preflight failure can exit before that finaliser and preserve it. Response content is captured and rewound after completion.
HTTP 4xx/5xx statuses normally remain inspectable through Response. Network/TLS/proxy/stream errors can raise. Retrying after an ambiguous failure can apply the patch twice; require an idempotency/precondition design before doing so.
The call blocks, inherits persistent headers/cookies/authentication, accepts unrestricted destinations, and uses the current non-validating local SSL configuration.
External references
Created 2026-07-15