问题描述
当我发送请求时,它总是返回状态码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 (将#修改为@)