TsgcHTTP3Client › 方法 › PutAsync
发送非阻塞 HTTP/3 PUT 请求;回复通过 OnResponse 传递。
procedure PutAsync(const aURL: string; const aData: string; const aContentType: string = 'application/json');
| 名称 | 类型 | 描述 |
|---|---|---|
aURL | const string | 请求发送目标资源的绝对 URL。 |
aData | const string | 发送给服务器的请求正文。 |
aContentType | const string | content-type 标头的值。默认为 application/json。 |
PutAsync 发送 HTTP/3 PUT 请求后立即返回,不阻塞调用线程。收到完整响应后,结果通过 OnResponse 事件传递;若请求失败,则触发 OnError。请将 aContentType 设置为与负载匹配的值,例如发送 JSON 文档时设为 application/json。如需阻塞式调用并直接返回响应体,请使用 Put。
oClient.OnResponse := OnResponseEvent;
oClient.PutAsync('https://api.example.com/v1/users/42', '{"name":"john"}');