网络请求可以不打印返回,如屏蔽词

This commit is contained in:
liangtongchuan
2021-12-26 15:49:11 +08:00
parent 31c6f61dc1
commit f86a35480e

View File

@@ -41,7 +41,7 @@ export async function httpRequest(url: string, method: string, body: any, header
}
}
export async function httpRequestForm(url: string, method: string, form: any, timeout = 150) {
export async function httpRequestForm(url: string, method: string, form: any, timeout = 150, printRes = true) {
console.log(`httpRequest*********: ${url}, ${method}, ${JSON.stringify(form)}`)
let options = {
@@ -62,7 +62,9 @@ export async function httpRequestForm(url: string, method: string, form: any, ti
try {
let res = await request(options);
console.log('*****request result*****');
console.log(JSON.stringify(res));
if (printRes) {
console.log(JSON.stringify(res));
}
return res;
} catch (e) {
console.error('******', e);
@@ -184,6 +186,6 @@ export async function request37CheckChat(url: string, body: Chat37Params, key: s
export async function request37GetWord(url: string, body: GetWordParam, key: string) {
body.setSign(get37Md5SignB(body.getBody(), key));
let result = await httpRequestForm(url, HTTP_METHOD.GET, body, 5 * 60 * 1000);
let result = await httpRequestForm(url, HTTP_METHOD.GET, body, 5 * 60 * 1000, false);
return result;
}