mm_https 1.4.5 → 1.4.6

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.
Files changed (3) hide show
  1. package/index.js +15 -10
  2. package/package.json +2 -2
  3. package/test.js +16 -13
package/index.js CHANGED
@@ -67,14 +67,19 @@ class Http {
67
67
 
68
68
  this.config = Object.assign({
69
69
  headers: {
70
- 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
71
- 'Accept-Encoding': 'gzip, deflate',
72
- 'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
73
- 'Cache-Control': 'max-age=0',
74
- 'Connection': 'keep-alive',
75
- 'Upgrade-Insecure-Requests': '1',
76
- 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
77
- 'X-Requested-With': 'XMLHttpRequest'
70
+ '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',
71
+ 'accept-encoding': 'gzip, deflate',
72
+ 'accept-language': 'zh-CN,zh;q=0.9',
73
+ 'cache-control': 'max-age=0',
74
+ 'sec-ch-ua': '"Google Chrome";v="95", "Chromium";v="95", ";Not A Brand";v="99"',
75
+ 'sec-ch-ua-mobile': '?0',
76
+ 'sec-ch-ua-platform': '"Windows"',
77
+ 'sec-fetch-dest': 'document',
78
+ 'sec-fetch-mode': 'navigate',
79
+ 'sec-fetch-site': 'none',
80
+ 'sec-fetch-user': '?1',
81
+ 'upgrade-insecure-requests': '1',
82
+ 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36'
78
83
  },
79
84
  rejectUnauthorized: false
80
85
  }, config)
@@ -178,7 +183,7 @@ Http.prototype.req = function(options, param) {
178
183
  }
179
184
  resolve({
180
185
  headers: res.headers,
181
- binary: buffer,
186
+ binary: decoded,
182
187
  body: body
183
188
  });
184
189
  }
@@ -195,7 +200,7 @@ Http.prototype.req = function(options, param) {
195
200
  }
196
201
  resolve({
197
202
  headers: res.headers,
198
- binary: buffer,
203
+ binary: decoded,
199
204
  body: body
200
205
  });
201
206
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
- {
1
+ {
2
2
  "name": "mm_https",
3
- "version": "1.4.5",
3
+ "version": "1.4.6",
4
4
  "description": "这是超级美眉http请求帮助类模块,可自动补充cookie,实现模拟登录,通讯",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/test.js CHANGED
@@ -101,19 +101,22 @@ var fs = require("fs");
101
101
  // test();
102
102
 
103
103
 
104
- // async function download(){
105
- // var hp = new Http();
106
- // var url = "https://pic.90tu.com/d/file/update/202005/26/b0lxtps0cpi08.jpg";
107
- // "./美女/中文".addDir();
108
- // var file = await hp.download(url, "./美女/中文", true, null, null);
109
- // console.log(file);
110
- // }
111
-
112
- async function test(){
104
+ async function download(){
113
105
  var hp = new Http();
114
- var url = "https://weibo.com/p/1003061669879400";
115
- var res = await hp.get(url);
116
- console.log(res);
106
+ // var url = "http://www.haoduoma.com/d/file/p/2021-06-18/76df67e451ca9dec9991588ad7fda6e6.jpg";
107
+ var url = "https://www.copipi.com/p/224/224/becce1fc21d723614b598f5377d5d676.jpg";
108
+ "./二维码/中文".addDir();
109
+ var filename = "./二维码/你好.jpg".fullname();
110
+ var file = await hp.download(url, filename);
111
+ console.log(file);
117
112
  }
113
+ download();
114
+
115
+ // async function test(){
116
+ // var hp = new Http();
117
+ // var url = "https://weibo.com/p/1003061669879400";
118
+ // var res = await hp.get(url);
119
+ // console.log(res);
120
+ // }
118
121
 
119
- test();
122
+ // test();