当我在 Postman 中向“https://api.github.com/users/octocat”发出 GET 请求时,它就可以工作了:
但是如果我尝试使用以下代码在 Delphi 中使用
TIdHTTP
来完成此操作:
procedure TForm1.Button1Click(Sender: TObject);
begin
var apiURL := 'https://api.github.com/users/octocat';
try
var IdHTTP := TIdHTTP.Create;
try
var jsonResponse := IdHTTP.Get(apiURL);
Memo1.Lines.Text := jsonResponse;
finally
IdHTTP.Free;
end;
except
on E: Exception do
ShowMessage('Error: ' + E.Message);
end;
end;
然后我得到一个错误:
项目引发异常类 EIdOSSLUnderlyingCryptoError 并显示消息“使用 SSL 连接时出错”。错误:1409442E:SSL 例程:ssl3_read_bytes:tlsv1 警报协议版本'
这是什么意思和/或我做错了什么?