提交 4b6bcdb8 编写于 作者: H hjdhnx

返回源码加编码还是搞不定

上级 bacfcfd3
...@@ -851,9 +851,8 @@ function request(url,obj){ ...@@ -851,9 +851,8 @@ function request(url,obj){
obj.headers = headers; obj.headers = headers;
} }
if(rule.encoding&&rule.encoding!=='utf-8'){ if(rule.encoding&&rule.encoding!=='utf-8'){
obj.headers["content-type"] = "text/html; charset="+rule.encoding; obj.headers["Content-Type"] = 'text/html; charset='+rule.encoding;
} }
console.log(JSON.stringify(obj.headers));
if(typeof(obj.headers.body)!='undefined'&&obj.headers.body&&typeof (obj.headers.body)==='string'){ if(typeof(obj.headers.body)!='undefined'&&obj.headers.body&&typeof (obj.headers.body)==='string'){
let data = {}; let data = {};
obj.headers.body.split('&').forEach(it=>{ obj.headers.body.split('&').forEach(it=>{
...@@ -869,6 +868,8 @@ function request(url,obj){ ...@@ -869,6 +868,8 @@ function request(url,obj){
obj.buffer = 2; obj.buffer = 2;
delete obj.toBase64 delete obj.toBase64
} }
console.log(JSON.stringify(obj.headers));
// console.log('request:'+url+' obj:'+JSON.stringify(obj));
console.log('request:'+url); console.log('request:'+url);
let res = req(url, obj); let res = req(url, obj);
let html = res.content||''; let html = res.content||'';
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册