我需要解析此标头值并传递到下一个api调用以获取cookie(令牌) Please see the snapshot
答案 0 :(得分:1)
尝试一下:
ResponseObject response = WS.sendRequest(findTestObject('Object Repository/YOUR_REQUEST'))
def parsed = new JsonSlurper().parseText(response.getResponseText())
println parsed.get("headers").get("location")
您将需要导入以下类:
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import com.kms.katalon.core.testobject.ResponseObject
答案 1 :(得分:0)
您可以尝试一下。我过去常常在标头中获取另一个字段
response = WS.sendRequest(findTestObject('Your_API'))
Map parsed = response.getHeaderFields()
String api= parsed.Api (base on the name of api that youn return)