egg-controller
Advanced tools
Comparing version 0.2.2 to 0.2.3
declare const _default: { | ||
controller: { | ||
/** auto load controller in 'ctrlDir', only require file, can't load to ctx */ | ||
autoLoad: boolean; | ||
/** controllers dir path,support array */ | ||
ctrlDir: string | string[]; | ||
/** generate frontend request sdk */ | ||
genSDK: { | ||
enable: boolean; | ||
/** generate code type, support ts/js */ | ||
type: "ts" | "js"; | ||
/** generate code dir path */ | ||
SDKDir: string; | ||
/** generate template */ | ||
templatePath: string; | ||
/** route filter for generate */ | ||
filter: RegExp[]; | ||
}; | ||
compatible: { | ||
/** | ||
* return 404 when controller didn't change ctx.body (egg default) | ||
* if 'false', will return 204 | ||
*/ | ||
ret404WhenNoChangeBody: boolean; | ||
}; | ||
}; | ||
@@ -13,0 +27,0 @@ aop: { |
@@ -6,11 +6,25 @@ "use strict"; | ||
controller: { | ||
/** auto load controller in 'ctrlDir', only require file, can't load to ctx */ | ||
autoLoad: true, | ||
/** controllers dir path,support array */ | ||
ctrlDir: path.join('app', 'controller'), | ||
/** generate frontend request sdk */ | ||
genSDK: { | ||
enable: false, | ||
/** generate code type, support ts/js */ | ||
type: 'ts', | ||
/** generate code dir path */ | ||
SDKDir: path.join('app', 'assets', 'service'), | ||
/** generate template */ | ||
templatePath: '', | ||
/** route filter for generate */ | ||
filter: [/^\/api\//g], | ||
}, | ||
compatible: { | ||
/** | ||
* return 404 when controller didn't change ctx.body (egg default) | ||
* if 'false', will return 204 | ||
*/ | ||
ret404WhenNoChangeBody: false, | ||
} | ||
}, | ||
@@ -17,0 +31,0 @@ aop: { |
@@ -120,3 +120,4 @@ "use strict"; | ||
} | ||
if (ctx.body === undefined && ctx.status === 404) { | ||
const { ret404WhenNoChangeBody } = ctx.app.config.controller.compatible; | ||
if (!ret404WhenNoChangeBody && ctx.body === undefined && ctx.status === 404) { | ||
ctx.status = 204; | ||
@@ -123,0 +124,0 @@ } |
{ | ||
"name": "egg-controller", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "controller for egg.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49637
1053