egg 2.31.0 → 2.32.0
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/History.md +13 -0
- package/lib/core/httpclient.js +14 -1
- package/package.json +2 -1
package/History.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# History
|
|
2
2
|
|
|
3
|
+
## 2021-11-15, Version 2.32.0 @atian25
|
|
4
|
+
|
|
5
|
+
### Notable Changes
|
|
6
|
+
|
|
7
|
+
* **features**
|
|
8
|
+
* handle ENETUNREACH error on httpclient
|
|
9
|
+
|
|
10
|
+
### Commits
|
|
11
|
+
|
|
12
|
+
* [[`189c47804`](http://github.com/eggjs/egg/commit/189c478048d820b7b1a6ba6e8bce3444604876ff)] - feat: handle ENETUNREACH error on httpclient (#4792) (fengmk2 <<fengmk2@gmail.com>>)
|
|
13
|
+
|
|
14
|
+
|
|
3
15
|
## 2021-10-18, Version 2.31.0 @killagu
|
|
4
16
|
|
|
5
17
|
### Notable Changes
|
|
@@ -11,6 +23,7 @@
|
|
|
11
23
|
|
|
12
24
|
* [[`debfda7ab`](https://github.com/eggjs/egg/commit/debfda7ab38f4893b6f122abfbf3e5288af1441e)] - feat(config): support ssrf field in security config. (#4778) (Jasin Yip <<yejunxing@gmail.com>>)
|
|
13
25
|
|
|
26
|
+
|
|
14
27
|
## 2021-08-09, Version 2.30.0 @mansonchor
|
|
15
28
|
|
|
16
29
|
### Notable Changes
|
package/lib/core/httpclient.js
CHANGED
|
@@ -4,6 +4,13 @@ const Agent = require('agentkeepalive');
|
|
|
4
4
|
const HttpsAgent = require('agentkeepalive').HttpsAgent;
|
|
5
5
|
const urllib = require('urllib');
|
|
6
6
|
const ms = require('humanize-ms');
|
|
7
|
+
const { FrameworkBaseError } = require('egg-errors');
|
|
8
|
+
|
|
9
|
+
class HttpClientError extends FrameworkBaseError {
|
|
10
|
+
get module() {
|
|
11
|
+
return 'httpclient';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
7
14
|
|
|
8
15
|
class HttpClient extends urllib.HttpClient2 {
|
|
9
16
|
constructor(app) {
|
|
@@ -42,7 +49,13 @@ class HttpClient extends urllib.HttpClient2 {
|
|
|
42
49
|
}
|
|
43
50
|
|
|
44
51
|
// the Promise style
|
|
45
|
-
return super.request(url, args)
|
|
52
|
+
return super.request(url, args)
|
|
53
|
+
.catch(err => {
|
|
54
|
+
if (err.code === 'ENETUNREACH') {
|
|
55
|
+
throw HttpClientError.create(err.message, err.code);
|
|
56
|
+
}
|
|
57
|
+
throw err;
|
|
58
|
+
});
|
|
46
59
|
}
|
|
47
60
|
|
|
48
61
|
curl(url, args, callback) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "egg",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.32.0",
|
|
4
4
|
"description": "A web framework's framework for Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"egg-cookies": "^2.3.0",
|
|
28
28
|
"egg-core": "^4.18.0",
|
|
29
29
|
"egg-development": "^2.4.2",
|
|
30
|
+
"egg-errors": "^2.3.0",
|
|
30
31
|
"egg-i18n": "^2.0.0",
|
|
31
32
|
"egg-jsonp": "^2.0.0",
|
|
32
33
|
"egg-logger": "^2.3.2",
|