refactor(项目管理): 修复自定义js代码请求api时生成的脚本没有判断响应码是否是200的问题
--bug=1014236 --user=宋天阳 【项目管理】自定义代码片段,js语言,导入接口定义,执行报错了 https://www.tapd.cn/55049933/s/1186949
This commit is contained in:
parent
411168eb84
commit
d5b66aa54d
|
@ -398,13 +398,16 @@ conn.setRequestMethod(requestMethod);
|
|||
conn.setDoOutput(true);
|
||||
${connStr}conn.connect();
|
||||
${postParamExecCode}
|
||||
var res = "";
|
||||
var rspCode = conn.getResponseCode();
|
||||
if (rspCode == 200) {
|
||||
var ipt = conn.getInputStream();
|
||||
var reader = new java.io.BufferedReader(new java.io.InputStreamReader(ipt, "UTF-8"));
|
||||
var lines;
|
||||
var res = "";
|
||||
while((lines = reader.readLine()) !== null) {
|
||||
res += lines;
|
||||
}
|
||||
}
|
||||
log.info(res);
|
||||
`;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue