TsgcHTTP3Client › 方法 › Post
发送携带正文负载的同步 HTTP/3 POST 请求并返回响应体。
function Post(const aURL: string; const aData: string; const aContentType: string = 'application/x-www-form-urlencoded'): string;
| 名称 | 类型 | 描述 |
|---|---|---|
aURL | const string | 请求发送目标资源的绝对 URL。 |
aData | const string | 发送给服务器的请求正文。 |
aContentType | const string | content-type 标头的值。默认为 application/x-www-form-urlencoded。 |
从服务器接收的响应体,解码为字符串。(string)
Post 阻塞调用线程直至收到完整的 HTTP/3 响应,并以字符串形式返回正文。将 aContentType 设为与负载匹配的值,例如发送 JSON 文档时设为 application/json。如需非阻塞请求,请使用 PostAsync,它将回复传递到 OnResponse。
vResponse := oClient.Post('https://api.example.com/v1/login', 'user=john&pass=secret');