如何解决Katalon无法发送请求
当我发送请求时,它总是返回状态码200,但响应直接指向登录页面,而不是请求的值。
这是我的手动脚本:
String mycookie = GlobalVariable.myToken
String mycsrf = GlobalVariable.mycsrf
String callfullurl = server+thepathURR+param
String authHeader = ""
TestObjectProperty header1 = new TestObjectProperty("Cookie",ConditionType.EQUALS,mycookie)
TestObjectProperty header2 = new TestObjectProperty("Content-Type","application/json")
TestObjectProperty header3 = new TestObjectProperty("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9")
ArrayList defaultHeaders = Arrays.asList(header1,header2,header3)
RequestObject ro = new RequestObject()
ro.setRestUrl(callfullurl)
ro.setFollowRedirects(true)
ro.setHttpHeaderProperties(defaultHeaders)
ro.setRestRequestMethod(method)
def respObj = WS.sendRequest(ro)
'Get the response of requested Ajax'
String response = respObj.getResponseText()
'Get the response status'
def chkcode = respObj.getStatusCode()
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。