[英]Facing issue while executing the groovy code in JMeter
def hawkClient = new com.wealdtech.hawk.HawkClient.Builder()
.credentials(new com.wealdtech.hawk.HawkCredentials.Builder()
.keyId("UB6Vs7U8r45M9")
.key("eFzPNjBgCFAbCFbu5NTxmSkGPYxqXLK3")
.algorithm(Algorithm.sha256)
.build())
.build();
def authorization = hawkClient.generateAuthorizationHeader(sampler.getUrl().toURI(), sampler.getMethod(), sampler.getArguments().getArgument(0).getValue())
vars.put('authorization', authorization)
當我在 JMeter 中執行上面的代碼片段時,得到了這個錯誤“javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: Algorithm for class: Script47”
有人可以幫我解決嗎?
您需要在腳本的開頭添加適當的import
語句:
import com.wealdtech.hawk.HawkCredentials
或者只使用完全限定的類名:
.algorithm(com.wealdtech.hawk.HawkCredentials.Algorithm.SHA256)
更多信息:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.