使用
<dyn_variable name="OK_Button" jsonpath="test.items[0].links[0].href"/>
我能够从json中提取下面的url
http://localhost:8081/mycode/1.5.0/extended/call/action
但是,在下一个请求中我想通过更改IP和端口来使用上面的URL
答案 0 :(得分:2)
例如:
<dyn_variable name="ok_button" jsonpath = "test.items[0].links[0].href"/>
<setdynvars sourcetype="eval"
code='fun({Pid,DynVars})->
{ok,Val}=ts_dynvars:lookup(ok_button,DynVars),
L1 = re:replace(Val,"localhost","192.169.1.100",[{return,list}]),
L2 = re:replace(L1,"8801","8800",[{return,list}]),
L2 end.'>
<var name="new_address" />
</setdynvars>
%% ok_button tolower
%% L2 = "http://192.169.1.100:8800/mycode/1.5.0/extended/call/action"
<request subst="true">
<http url="%%_new_address%%" method="POST" contents="......."
</request>