egg 3.17.4 → 3.17.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.
- package/README.md +1 -1
- package/config/config.default.js +8 -1
- package/index.d.ts +1 -1
- package/lib/core/singleton.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
package/config/config.default.js
CHANGED
|
@@ -236,8 +236,15 @@ module.exports = appInfo => {
|
|
|
236
236
|
depth: 5,
|
|
237
237
|
parameterLimit: 1000,
|
|
238
238
|
},
|
|
239
|
-
onerror(err) {
|
|
239
|
+
onerror(err, ctx) {
|
|
240
240
|
err.message += ', check bodyParser config';
|
|
241
|
+
if (ctx.status === 404) {
|
|
242
|
+
// set default status to 400, meaning client bad request
|
|
243
|
+
ctx.status = 400;
|
|
244
|
+
if (!err.status) {
|
|
245
|
+
err.status = 400;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
241
248
|
throw err;
|
|
242
249
|
},
|
|
243
250
|
};
|
package/index.d.ts
CHANGED
|
@@ -449,7 +449,7 @@ declare module 'egg' {
|
|
|
449
449
|
/**
|
|
450
450
|
* i18n resource file dir, not recommend to change default value
|
|
451
451
|
*/
|
|
452
|
-
|
|
452
|
+
dirs: string[];
|
|
453
453
|
/**
|
|
454
454
|
* custom the locale value field, default `query.locale`, you can modify this config, such as `query.lang`
|
|
455
455
|
*/
|
package/lib/core/singleton.js
CHANGED
|
@@ -34,7 +34,7 @@ class Singleton {
|
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
// multi
|
|
37
|
+
// multi client, use app[name].getInstance(id)
|
|
38
38
|
if (options.clients) {
|
|
39
39
|
Object.keys(options.clients).forEach(id => {
|
|
40
40
|
const client = this.createInstance(options.clients[id], id);
|
|
@@ -61,7 +61,7 @@ class Singleton {
|
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
// multi
|
|
64
|
+
// multi client, use app[name].getInstance(id)
|
|
65
65
|
if (options.clients) {
|
|
66
66
|
await Promise.all(Object.keys(options.clients).map(id => {
|
|
67
67
|
return this.createInstanceAsync(options.clients[id], id)
|