TsgcHTTP3Client › 方法 › Delete

Delete 方法

发送同步 HTTP/3 DELETE 请求并返回响应体。

语法

function Delete(const aURL: string): string; overload;
procedure Delete(const aURL: string; const aResponseContent: TStream); overload;

参数

名称类型描述
aURLconst string要删除资源的绝对 URL。
aResponseContentTStream接收原始响应体的流(仅流重载)。

返回值

从服务器接收的响应体,解码为字符串。流重载将正文写入 aResponseContent。(string)

备注

Delete 阻塞调用线程直至收到完整的 HTTP/3 响应。当回复为文本且能装入内存时使用第一个重载;使用流重载将原始正文直接写入 TStream(例如文件或内存流)。若客户端尚未连接,则先使用 URL 打开连接。如需非阻塞请求,请使用 DeleteAsync,它将回复传递到 OnResponse。

示例


vResponse := oClient.Delete('https://api.example.com/v1/users/42');

返回方法