[英]Tsung replace characters in a dynamic variable
運用
<dyn_variable name="OK_Button" jsonpath="test.items[0].links[0].href"/>
我能夠從json http://localhost:8081/mycode/1.5.0/extended/call/action
提取以下網址
但是,在下一個請求中,我想通過更改IP和端口來使用上述url
例如:
<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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.