TsgcHTTP2Client › Methods › Delete
执行同步 HTTP/2 DELETE 请求,删除 URL 所标识的资源。
function Delete(const aURL: string): string;
| 名称 | 类型 | 描述 |
|---|---|---|
aURL | const string | 要在服务器上删除的资源的绝对 URL。 |
响应体(通常是 JSON 状态文档),解码为字符串。(string)
DELETE 请求通常不携带请求体。成功的调用通常返回空字符串的 204 No Content,或根据服务器不同返回带有确认文档的 200 OK。
vResponse := oClient.Delete('https://api.example.com/users/42');
procedure Delete(Const aURL: string; const aResponseContent: TStream);
| 名称 | 类型 | 描述 |
|---|---|---|
aURL | const string | 要在服务器上删除的资源的绝对 URL。 |
aResponseContent | const TStream | 收集服务器响应体原文的流。 |
基于流的变体,将响应捕获到调用方提供的 TStream 中。当删除响应可能很大或需要直接持久化到磁盘时,请选择此重载。
oOut := TMemoryStream.Create;
try
oClient.Delete('https://api.example.com/users/42', oOut);
finally
oOut.Free;
end;