mm_https 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -274,11 +274,6 @@ Http.prototype.request = function(options) {
274
274
  } = res;
275
275
  var chunks = [];
276
276
  var encoding = headers['content-encoding'];
277
- if (encoding) {
278
- // res.setEncoding('utf-8');
279
- } else {
280
- res.setEncoding("binary");
281
- }
282
277
  res.on('data', function(d) {
283
278
  chunks.push(d);
284
279
  }).on('end', function(d) {
@@ -307,7 +302,8 @@ Http.prototype.request = function(options) {
307
302
  resolve({
308
303
  status: 200,
309
304
  headers,
310
- body: body
305
+ buffer,
306
+ body
311
307
  });
312
308
  });
313
309
  } else {
@@ -404,7 +400,7 @@ Http.prototype.download = async function(url, filename, auto, headers, cookie) {
404
400
  file = filename;
405
401
  }
406
402
  if (file) {
407
- var length = await fs.writeFileSync(file, res.body, "binary");
403
+ var length = await fs.writeFileSync(file, res.buffer, "binary");
408
404
  if (length == 0) {
409
405
  file = null;
410
406
  }
package/logonew.png ADDED
Binary file
package/nodemon.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "restartable": "rs",
3
+ "ignore": [
4
+ ".git",
5
+ ".svn",
6
+ "node_modules/**/node_modules",
7
+ "static"
8
+ ],
9
+ "verbose": true,
10
+ "execMap": {
11
+ "": "node",
12
+ "js": "node --harmony"
13
+ },
14
+ "env": {
15
+ "NODE_ENV": "development"
16
+ },
17
+ "ext": "js ts json",
18
+ "legacy-watch": false
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_https",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "这是超级美眉http请求帮助类模块,可自动补充cookie,实现模拟登录,通讯",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/test.js CHANGED
@@ -94,19 +94,30 @@ var fs = require("fs");
94
94
  // // console.log('结果:', hp.cookies);
95
95
  // }
96
96
 
97
+ // async function test() {
98
+ // var hp = new Http();
99
+ // hp.config.headers.Accept = "application/javascript; charset=UTF-8";
100
+ // var url =
101
+ // "http://69.push2.eastmoney.com/api/qt/clist/get?cb=jQuery1124007023275733383882_1586573202818&pn=1&pz=100000&po=1&np=1&ut=bd1d9ddb04089700cf9c27f6f7426281&fltt=2&invt=2&fid=f3&fs=m:0+t:6,m:0+t:13,m:0+t:80,m:1+t:2,m:1+t:23&fields=f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152";
102
+ // var res = await hp.get(url);
103
+ // console.log(res);
104
+ // }
105
+
106
+
97
107
  async function test() {
98
108
  var hp = new Http();
99
109
  hp.config.headers.Accept = "application/javascript; charset=UTF-8";
100
- var url =
101
- "http://69.push2.eastmoney.com/api/qt/clist/get?cb=jQuery1124007023275733383882_1586573202818&pn=1&pz=100000&po=1&np=1&ut=bd1d9ddb04089700cf9c27f6f7426281&fltt=2&invt=2&fid=f3&fs=m:0+t:6,m:0+t:13,m:0+t:80,m:1+t:2,m:1+t:23&fields=f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152";
110
+ var url ="http://localhost:8001/api/wallet/count";
102
111
  var res = await hp.get(url);
112
+ console.log(res);
103
113
  }
104
114
 
105
115
  // async function test() {
116
+ // console.log("测试")
106
117
  // var hp = new Http();
107
- // var res = await hp.get('http://localhost:8080/dev/img/logo_gray.png');
118
+ // var res = await hp.get('https://www.baidu.com/img/flexible/logo/pc/result.png');
108
119
  // console.log(res);
109
- // fs.writeFile("./logonew.png", res.body, "binary", function(err) {
120
+ // fs.writeFile("./logonew.png", res.buffer, "binary", function(err) {
110
121
  // if (err) {
111
122
  // console.log("下载失败");
112
123
  // }