Delphi - Tokyo XE 10.2 RESTFUL 客户端库 Request/Response
Delphi - Tokyo XE 10.2 RESTFUL Client Library Request/Response
通过此代码示例通过 Delphi Rest 客户端库实现 运行 Req/Resp。想知道通过显示的关于为请求参数赋值的示例是否可以是动态的?
示例中的值是硬编码的,并且链接了一个 TEdit 按钮,但我看不出我们如何能够将值从 TEdit 输入传递到值的 Request 参数。
截图:
是的。您可以从代码更改请求参数值。 Params property is just a collection of TRESTRequestParameter type items (the collection itself is of the TRESTRequestParameterList 类型)。例如写:
{ there seems to be only indexed access implemented for this
collection, so to access the first parameter value write }
RESTRequest1.Params[0].Value := Edit1.Text;
通过此代码示例通过 Delphi Rest 客户端库实现 运行 Req/Resp。想知道通过显示的关于为请求参数赋值的示例是否可以是动态的?
示例中的值是硬编码的,并且链接了一个 TEdit 按钮,但我看不出我们如何能够将值从 TEdit 输入传递到值的 Request 参数。
截图:
是的。您可以从代码更改请求参数值。 Params property is just a collection of TRESTRequestParameter type items (the collection itself is of the TRESTRequestParameterList 类型)。例如写:
{ there seems to be only indexed access implemented for this
collection, so to access the first parameter value write }
RESTRequest1.Params[0].Value := Edit1.Text;