import groovy.json.JsonSlurper
def appToken = "8ry+2bvULHbuYMu75bl80vDBYC3sDbq26JUpCNd19Is="
def downloadURL = "https://api.thetradedesk.com/v3/myreports/view/9411002/538769/1507695066?sig=C0G46d8hyTJGk8blhW8smgo27JzaWDjaNogtVQaJ-Lg."
def result
def process = ["path\\curl.exe", "-X", "GET", downloadURL,
"-H", "cache-control: no-cache",
"-H", "postman-token: 21cc8561-8e79-0e85-ad60-ea6e4b69dda2",
"-H", "ttd-auth:"+appToken]
result = process.execute()
/*def slurper = new groovy.json.JsonSlurper()
def jsonSlurper = slurper.parseText(slurper)*/
log.info result.text
======================================= 当我在SOAP UI中运行groovy脚本时,它在POSTMAN中工作时返回空白响应。
Pl. Note: App Token expires in every 5 mins so this token wont be valid after my post, please suggest me how to handle GET response using SOAP UI for cURL request?
答案 0 :(得分:0)
尝试将命令编写为单个字符串,使用+连接变量,例如:
def process = "path\\curl.exe -X, GET "+ downloadURL+ "-H, cache-control: no-cache, -H, postman-token: 21cc8561-8e79-0e85-ad60-ea6e4b69dda2, -H, ttd-auth: "+appToken
之后做一个
log.info process
在创建和运行命令之间检查命令。