TsgcHTTP3Client › 方法 › PatchAsync

PatchAsync 方法

发送非阻塞 HTTP/3 PATCH 请求;回复通过 OnResponse 传递。

语法

procedure PatchAsync(const aURL: string; const aData: string; const aContentType: string = 'application/json');

参数

名称类型描述
aURLconst string请求发送目标资源的绝对 URL。
aDataconst string发送给服务器的部分更新请求正文。
aContentTypeconst stringcontent-type 标头的值。默认为 application/json。

备注

PatchAsync 发送 HTTP/3 PATCH 请求后立即返回,不阻塞调用线程。收到完整响应后,结果通过 OnResponse 事件传递;若请求失败,则触发 OnError。PATCH 仅发送资源的变更部分,而非替换整个资源。如需阻塞式调用并直接返回响应体,请使用 Patch。

示例


oClient.OnResponse := OnResponseEvent;
oClient.PatchAsync('https://api.example.com/v1/users/42', '{"name":"john"}');

返回方法