TsgcHTTP2Client › 方法 › PutAsync
发送非阻塞 HTTP/2 PUT 请求;服务器回复通过 OnHTTP2Response 投递。
procedure PutAsync(const aURL: string; const aSource: TStream);
| 名称 | 类型 | 描述 |
|---|---|---|
aURL | const string | 标识将要创建或替换的资源的绝对 URL。 |
aSource | const TStream | 提供要存储的资源完整表示的流。 |
Put 的非阻塞变体。调用在流被序列化为 HTTP/2 DATA 帧后立即返回;确认(状态码、标头和正文)稍后通过 OnHTTP2Response 返回。适用于不得冻结的 UI 驱动代码路径。
oClient.OnHTTP2Response := OnHTTP2ResponseEvent;
oBody := TStringStream.Create('{"status":"active"}');
try
oClient.Request.ContentType := 'application/json';
oClient.PutAsync('https://api.example.com/users/42', oBody);
finally
oBody.Free;
end;