TsgcHTTP3Client › 메서드 › PostAsync
비차단 HTTP/3 POST 요청을 보냅니다. 응답은 OnResponse에서 수신됩니다.
procedure PostAsync(const aURL: string; const aData: string; const aContentType: string = 'application/x-www-form-urlencoded');
| Name | Type | 설명 |
|---|---|---|
aURL | const string | 요청이 전송되는 리소스의 절대 URL입니다. |
aData | const string | 서버로 전송되는 요청 본문. |
aContentType | const string | content-type 헤더의 값. 기본값은 application/x-www-form-urlencoded입니다. |
PostAsync는 HTTP/3 POST 요청을 보내고 호출 스레드를 차단하지 않고 즉시 반환합니다. 전체 응답이 수신되면 OnResponse 이벤트에서 전달됩니다. 요청이 실패하면 대신 OnError가 발생합니다. 페이로드에 맞게 aContentType을 설정하십시오. 예를 들어 JSON 문서를 보낼 때는 application/json으로 설정합니다. 본문을 직접 반환하는 차단 호출에는 Post를 사용하십시오.
oClient.OnResponse := OnResponseEvent;
oClient.PostAsync('https://api.example.com/v1/login', 'user=john&pass=secret');